Re: How would I write this query... - Mailing list pgsql-general

From John D. Burger
Subject Re: How would I write this query...
Date
Msg-id 08c9bd676d30ce46237d7469263f8ad1@mitre.org
Whole thread Raw
In response to Re: How would I write this query...  ("Guy Rouillier" <guyr@masergy.com>)
Responses Re: How would I write this query...
List pgsql-general
> select *
> from people
> where id not in
> (
> select id
> from class_registration
> )

In my experience, queries like the OUTER LEFT JOIN version posted
earlier are usually much more efficient than NOT IN queries like the
above.  The planner seems to be pretty smart about turning (positive)
IN queries into joins, but NOT IN queries usually turn into nested
table scans, in my experience.

- John D. Burger
   MITRE


pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Leading substrings - alternatives with 8.1.3?
Next
From: "codeWarrior"
Date:
Subject: Re: selecting column comment