Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id A093E1337B71 for ; Fri, 5 Nov 2010 13:08:51 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 91078-09 for ; Fri, 5 Nov 2010 16:08:44 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gw.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by mail.postgresql.org (Postfix) with ESMTP id AA07B1337B7D for ; Fri, 5 Nov 2010 13:08:43 -0300 (ADT) Received: from Courts-MTA by gw.wicourts.gov with Novell_GroupWise; Fri, 05 Nov 2010 11:08:42 -0500 Message-Id: <4CD3E5B8020000250003735A@gw.wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 8.0.1 Date: Fri, 05 Nov 2010 11:08:40 -0500 From: "Kevin Grittner" To: "Scott Marlowe" , "Oliveiros d'Azevedo Cristina" , "Jonathan Hoover" Cc: Subject: Re: Get Postgres to use multiple proc cores? References: <68C107706843A54BA7D9CAEF123ADF05010346C955@SP2-EX07VS03.ds.corp.yahoo.com> <7B7990F174D348D28AA43F21640F5EAE@marktestcr.marktest.pt> In-Reply-To: <7B7990F174D348D28AA43F21640F5EAE@marktestcr.marktest.pt> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.21 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201011/53 X-Sequence-Number: 36019 "Oliveiros d'Azevedo Cristina" wrote: > What is faster? A JOIN or a WHERE a IN (SELECT ... ) On 8.4 and later an EXISTS or NOT EXISTS will use semi-join or anti-join (respectively). These should usually be much faster than the IN (SELECT DISTINCT ... ) technique. Be careful of the difference in semantics between NOT EXISTS and NOT IN if any of the columns involved in the matching can be null -- they are *not* the same thing. -Kevin