Received: from candle.pha.pa.us (candle.navpoint.com [162.33.245.46]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f941xvn65666 for ; Wed, 3 Oct 2001 21:59:57 -0400 (EDT) (envelope-from pgman@candle.pha.pa.us) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id f941xio07679; Wed, 3 Oct 2001 21:59:44 -0400 (EDT) From: Bruce Momjian Message-Id: <200110040159.f941xio07679@candle.pha.pa.us> Subject: Re: EXISTS Keyword In-Reply-To: <200110040118.3520@lh00.opsion.fr> "from cnliou@eurosport.com at Oct 4, 2001 01:18:53 am" To: cnliou@eurosport.com Date: Wed, 3 Oct 2001 21:59:44 -0400 (EDT) CC: pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL90 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200110/43 X-Sequence-Number: 4998 > Hello! > > I vaguely remember that someone said somewhere that > EXISTS runs faster than IN: > > SELECT * FROM table1 where field1 EXISTS (SELECT > field4 FROM table2) Move field1 into the subquery and join it to table2. See the FAQ for an example. -- 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