Received: from shaked.cc.openu.ac.il (shaked.cc.openu.ac.il [147.233.145.65]) by hub.org (8.9.1/8.9.1) with ESMTP id GAA14606 for ; Sun, 22 Nov 1998 06:17:32 -0500 (EST) (envelope-from herouth@oumail.openu.ac.il) Received: from [147.233.159.109] (herouth@mac-herouth.pc.openu.ac.il [147.233.159.109]) by shaked.cc.openu.ac.il (8.8.8/8.8.8) with ESMTP id NAA18637; Sun, 22 Nov 1998 13:17:10 +0200 (IST) X-Sender: herouth@shaked.cc.openu.ac.il Message-Id: In-Reply-To: <19981120022608.22274.rocketmail@send102.yahoomail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Date: Sun, 22 Nov 1998 13:18:03 +0200 To: Michael Olivier , "pgsql-sql postgresql.org" From: Herouth Maoz Subject: Re: [SQL] optimizing 2-table join w/millions of rows At 4:26 +0200 on 20/11/98, Michael Olivier wrote: > > select U.acctname from usertest U, bgndtest B where > B.part_needed=3 and B.loc_needed=5 and > B.acctname=U.acctname and U.acctname in > (select acctname from usertest where part=2 and loc=3) Can you explain *verbally* what you meant to do here? It seems as if the subselect is redundant. How about: SELECT U.acctname FROM usertest U, bgndtest B WHERE B.acctname = U.acctname AND B.part_needed=3 AND B.loc_needed=5 AND U.part=2 AND U.loc=3; Herouth -- Herouth Maoz, Internet developer. Open University of Israel - Telem project http://telem.openu.ac.il/~herutma