Received: from vote-smart.org (unknown [12.32.42.180]) by postgresql.org (Postfix) with SMTP id D909547605C for ; Mon, 22 Apr 2002 19:26:27 -0400 (EDT) Received: (qmail 13633 invoked by uid 1041); 22 Apr 2002 23:28:06 -0000 Received: from clinton@vote-smart.org by eleanor2 by uid 1038 with qmail-scanner-1.10 (hbedv: 6.12.0.0. . Clear:0. Processed in 0.553873 secs); 22 Apr 2002 23:28:06 -0000 Received: from dhcp-254.vote-smart.org (HELO booty.vote-smart.org) (192.168.255.254) by eleanor2.vote-smart.org with SMTP; 22 Apr 2002 23:28:05 -0000 Content-Type: text/plain; charset="iso-8859-1" From: Clinton Adams Reply-To: clinton@vote-smart.org To: Laurette Cisneros , pgsql-sql@postgresql.org Subject: Re: efficient query help Date: Mon, 22 Apr 2002 17:23:58 -0400 X-Mailer: KMail [version 1.4] References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200204221723.58261.clinton@vote-smart.org> X-Archive-Number: 200204/271 X-Sequence-Number: 7535 > I have crafted the following query which returns the results I want but > runs extremely slow (I'm sure it's the "not in" part that does it) since > the tables can contain large amounts of data. > > Is there a better, more efficient way to build this query? Why not try NOT EXISTS? I find that NOT IN bogs down on even simple queries.