Re: [PERFORM] IN or EXISTS

2011-09-22 Thread Jeff Davis
On Wed, 2011-08-31 at 09:33 +0800, Craig Ringer wrote: > On the other hand, the `IN' subquery is uncorrelated needs only run > once, where the `EXISTS' subquery is correlated and has to run once for > every outer record. If the EXISTS looks semantically similar to an IN (aside from NULL semantic

Re: [PERFORM] IN or EXISTS

2011-08-31 Thread Tomas Vondra
On 31 Srpen 2011, 15:59, Andy Colson wrote: > I assume: > Buckets: 16384 Batches: 1 Memory Usage: 4531kB > > That means a total of 4.5 meg of ram was used for the hash, so if my > work_mem was lower than that it would swap? (or choose a different plan?) Why don't you try that? Just set the work

Re: [PERFORM] IN or EXISTS

2011-08-31 Thread Andy Colson
On 8/30/2011 8:33 PM, Craig Ringer wrote: On 31/08/2011 4:30 AM, Andy Colson wrote: Hi all, I have read things someplace saying not exists was better than not in... or something like that. Not sure if that was for in/exists and not in/not exists, and for a lot of records or not. `EXISTS' may

Re: [PERFORM] IN or EXISTS

2011-08-31 Thread Craig Ringer
On 31/08/2011 4:30 AM, Andy Colson wrote: Hi all, I have read things someplace saying not exists was better than not in... or something like that. Not sure if that was for in/exists and not in/not exists, and for a lot of records or not. `EXISTS' may perform faster than `IN', yes. Using `IN