Re: Index Usage using IN

From: "Jeffrey W(dot) Baker" <jwbaker(at)acm(dot)org>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: Index Usage using IN
Date: 2006-02-01 20:22:50
Message-ID: 1138825370.8376.5.camel@toonses.gghcwest.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Thu, 2006-02-02 at 09:12 +1300, Ralph Mason wrote:
> Hi,
>
> I have 2 tables both have an index on ID (both ID columns are an oid).
>
> I want to find only only rows in one and not the other.
>
> 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

?

-jwb

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Kevin Grittner 2006-02-01 20:24:39 Re: Planner reluctant to start from subquery
Previous Message Tom Lane 2006-02-01 20:14:45 Re: Planner reluctant to start from subquery