Re: Weird NOT IN effect with NULL values

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: josh(at)agliodbs(dot)com
Cc: sqllist <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Weird NOT IN effect with NULL values
Date: 2001-03-01 20:46:11
Message-ID: 200103012046.PAA19437@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> SELECT name
> FROM customer
> WHERE NOT EXISTS (
> SELECT customer_id
> FROM salesorder
> WHERE customer_id = customer.customer_id
> );
>
> Bruce, you may want to consider editing your next edition to include the
> above modification. WHERE ... NOT IN is a bad idea for any subselect on
> medium-large tables.

FAQ item mentions this, and section 8.2 shows eqivalency at the end of
the section.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Laurent 2001-03-02 10:34:50 lo_import for storing Blobs
Previous Message Terry Fielder 2001-03-01 20:46:06 SQL copy from csv with explicit field ordering