Received: from candle.pha.pa.us (candle.navpoint.com [162.33.245.46]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f21KkHx90125 for ; Thu, 1 Mar 2001 15:46:17 -0500 (EST) (envelope-from pgman@candle.pha.pa.us) Received: (from pgman@localhost) by candle.pha.pa.us (8.9.0/8.9.0) id PAA19437; Thu, 1 Mar 2001 15:46:11 -0500 (EST) From: Bruce Momjian Message-Id: <200103012046.PAA19437@candle.pha.pa.us> Subject: Re: Weird NOT IN effect with NULL values In-Reply-To: <3A9E95A7.63FE080D@agliodbs.com> "from Josh Berkus at Mar 1, 2001 10:32:07 am" To: josh@agliodbs.com Date: Thu, 1 Mar 2001 15:46:11 -0500 (EST) CC: sqllist X-Mailer: ELM [version 2.4ME+ PL77 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200103/14 X-Sequence-Number: 1656 > 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@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026