Re: Index Usage using IN

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ralph Mason <ralph(dot)mason(at)telogis(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Index Usage using IN
Date: 2006-02-01 20:41:09
Message-ID: 4387.1138826469@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

"Jeffrey W. Baker" <jwbaker(at)acm(dot)org> writes:
> On Thu, 2006-02-02 at 09:12 +1300, Ralph Mason wrote:
>> Select ID from TableA where ID not IN ( Select ID from Table B)

> Have you considered this:

> SELECT ID from TableA EXCEPT Select ID from Table B

Also, increasing work_mem might persuade the planner to try a hashed
subplan, which'd be a lot better than what you have. Note that it's
quite unlikely that indexes are going to help for this.

regards, tom lane

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Kevin Grittner 2006-02-01 20:43:01 Re: Planner reluctant to start from subquery
Previous Message Tom Lane 2006-02-01 20:36:15 Re: Planner reluctant to start from subquery