Re: IN or EXISTS

From: "Tomas Vondra" <tv(at)fuzzy(dot)cz>
To: "Andy Colson" <andy(at)squeakycode(dot)net>
Cc: "Craig Ringer" <ringerc(at)ringerc(dot)id(dot)au>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: IN or EXISTS
Date: 2011-08-31 14:19:36
Message-ID: cf12201c9c3aa4a29a5c2ed26c7853ce.squirrel@sq.gransy.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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_mem to 1MB or so and run the query.

I think it'll use the same plan but multiple batches - read just part of
the inner table so that the hash table fits into work_mem, scan the outer
table etc. The downside is it'd rescan the outer table several times.

Tomas

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Andy Colson 2011-08-31 18:26:57 Re: Slow performance
Previous Message Andy Colson 2011-08-31 13:59:59 Re: IN or EXISTS