Re: [PERFORM] Performance trouble finding records through related records

2011-03-10 Thread sverhagen
Hi, all. I've done some further analysis, found a form that works if I split things over two separate queries (B1 and B2, below) but still trouble when combining (B, below). This is the full pseudo-query: SELECT FROM A UNION SELECT FROM B ORDER BY dateTime DESC LIMIT 50 In that pseudo-query:

Re: [PERFORM] Performance trouble finding records through related records

2011-03-08 Thread sverhagen
Merlin Moncure-2 wrote: > > > 8.3? try converting the above to WHERE EXISTS or (even better) a JOIN... > > Thanks for that. But in my Mar 03, 2011; 10:19am post I already broke it down to the barebones with some variations, among which JOIN. The EXISTS IN variation was so poor that I left th

Re: [PERFORM] Performance trouble finding records through related records

2011-03-08 Thread sverhagen
Hi. Thanks for your response. Robert Haas wrote: > > Join Filter: ((events_events.transactionid)::text = > (customerdetails.transactionid)::text) > > Now why is there a cast to text there on both sides? Do those two > columns have exactly the same datatype? If not, you probably want to > fix

Re: [PERFORM] Performance trouble finding records through related records

2011-03-03 Thread sverhagen
Andy Colson wrote: > > For your query, I think a join would be the best bet, can we see its > explain analyze? > Here is a few variations: SELECT events_events.* FROM events_events WHERE transactionid IN ( SELECT transactionid FROM events_eventdetails customerDetails WHERE cu

Re: [PERFORM] Performance trouble finding records through related records

2011-03-02 Thread sverhagen
Thanks for your help already! Hope you're up for some more :-) Andy Colson wrote: > > First off, excellent detail. > > Second, your explain analyze was hard to read... but since you are not > really interested in your posted query, I wont worry about looking at > it... but... have you seen: >

[PERFORM] Performance trouble finding records through related records

2011-03-01 Thread sverhagen
Hi, appreciated mailing list. Thanks already for taking your time for my performance question. Regards, Sander. ===POSTGRESQL VERSION AND ORIGIN=== PostgreSQL 8.3.9 on i486-pc-linux-gnu, compiled by GCC cc (GCC) 4.2.4 (Ubuntu 4.2.4-1ubuntu3) Installed using "apt-get install postgresql-8.3" ===

Re: [PERFORM] Strange workaround for slow query

2010-03-10 Thread sverhagen
> Thanks - I'm sorry that I was not more specific earlier, but what would > be *really* helpful is the output of explain analyze, since that also > shows actual time, # rows and # loops of the inner nestloop. No problem at all. EXPLAIN ANALYZE SELECT * FROM events_events LEFT OUTER JOIN events_

Re: [PERFORM] Strange workaround for slow query

2010-03-10 Thread sverhagen
Hi, EXPLAIN SELECT * FROM events_events LEFT OUTER JOIN events_event_types ON eventType_id=events_event_types.id WHERE severity=20 AND (eventType_id IN (71)) ORDER BY datetime DESC limit 50; QUERY PLAN ---

[PERFORM] Strange workaround for slow query

2010-03-10 Thread sverhagen
Hi group, We have two related tables with event types and events. We query for a join between these two tables and experience that, when there is an to-be-expected very small result set, this query performs particularly poor. Understanding in this matter would be appreciated. SELECT * from eve