Re: [HACKERS] Damn slow query

2002-10-09 Thread Joe Conway
Magnus Naeslund(f) wrote: > One thing to note here is that the JOIN query that Joe suggested is both > faster than the subselect thing (no suprise) but also don't care if > z2test has an index on it or not. It's worth noting though that JOIN is not always the fastest method. I've found situation

Re: [HACKERS] Damn slow query

2002-10-09 Thread Magnus Naeslund(f)
Bruce Momjian <[EMAIL PROTECTED]> wrote: > > We already have a TODO item: > > * Allow Subplans to use efficient joins(hash, merge) with upper > variable Cool. One thing to note here is that the JOIN query that Joe suggested is both faster than the subselect thing (no suprise) but also don't care

Re: [HACKERS] Damn slow query

2002-10-09 Thread Bruce Momjian
Magnus Naeslund(f) wrote: > Joe Conway <[EMAIL PROTECTED]> wrote: > > "IN (subselect)" is notoriously slow (in fact it is an FAQ). Can you > > rewrite this as: > > > > ... > > Stephan Szabo <[EMAIL PROTECTED]> wrote: > > Per FAQ suggestion, try something like > > ... > > Thanks alot, below are

Re: [HACKERS] Damn slow query

2002-10-09 Thread Magnus Naeslund(f)
Joe Conway <[EMAIL PROTECTED]> wrote: > "IN (subselect)" is notoriously slow (in fact it is an FAQ). Can you > rewrite this as: > ... Stephan Szabo <[EMAIL PROTECTED]> wrote: > Per FAQ suggestion, try something like ... Thanks alot, below are the results on your suggestions, quite an dramatic

Re: [HACKERS] Damn slow query

2002-10-09 Thread Joe Conway
Magnus Naeslund(f) wrote: > Hello, i've got this query that's really slow... > Figure this: > > testdb=> select now() ; select gid from bs where gid not in ( select x > from z2test ); select now(); "IN (subselect)" is notoriously slow (in fact it is an FAQ). Can you rewrite this as: select b.g

Re: [HACKERS] Damn slow query

2002-10-09 Thread Stephan Szabo
On Wed, 9 Oct 2002, Magnus Naeslund(f) wrote: > Hello, i've got this query that's really slow... > Figure this: > > testdb=> select now() ; select gid from bs where gid not in ( select x > from z2test ); select now(); Per FAQ suggestion, try something like select gid from bs where not exists (s

[HACKERS] Damn slow query

2002-10-09 Thread Magnus Naeslund(f)
Hello, i've got this query that's really slow... Figure this: testdb=> select now() ; select gid from bs where gid not in ( select x from z2test ); select now(); now --- 2002-10-09 22:37:21.234627+02 (1 row) gid -- (524 rows)