Received: from davinci.ethosmedia.com (davinci.ethosmedia.com [209.10.40.250]) by postgresql.org (Postfix) with ESMTP id 87B3C4763EC for ; Wed, 6 Mar 2002 15:25:31 -0500 (EST) Received: from [209.10.40.250] (account ) by davinci.ethosmedia.com (CommuniGate Pro WebUser 3.5.2) with HTTP id 819049; Wed, 06 Mar 2002 12:25:30 -0800 From: "Josh Berkus" Subject: Re: where not exists To: "Llew" , pgsql-sql@postgresql.org X-Mailer: CommuniGate Pro Web Mailer v.3.5.2 Date: Wed, 06 Mar 2002 12:25:30 -0800 Message-ID: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit X-Archive-Number: 200203/74 X-Sequence-Number: 6955 Llew, Do it all in one query: > DELETE FROM a > WHERE NOT EXISTS > ( > SELECT b.join1 > FROM b > WHERE > a.join1 = b.join1 AND > a.join2 = b.join2 > ) And make sure that join1 and join2 are indexed in both tables. -Josh Berkus