Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 9789E9F9797 for ; Wed, 22 Aug 2007 21:21:12 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 64540-08 for ; Wed, 22 Aug 2007 21:21:08 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from mtai04.charter.net (mtai04.charter.net [209.225.8.184]) by postgresql.org (Postfix) with ESMTP id 3D9119FA06A for ; Wed, 22 Aug 2007 21:21:08 -0300 (ADT) Received: from aa04.charter.net ([10.20.200.156]) by mtai04.charter.net (InterMail vM.7.08.02.00 201-2186-121-20061213) with ESMTP id <20070823002107.FYAX12338.mtai04.charter.net@aa04.charter.net>; Wed, 22 Aug 2007 20:21:07 -0400 Received: from [10.0.1.2] (really [66.188.165.91]) by aa04.charter.net with ESMTP id <20070823002106.JZWY1254.aa04.charter.net@[10.0.1.2]>; Wed, 22 Aug 2007 20:21:06 -0400 In-Reply-To: <200708230900.13878.scldad@sdc.com.au> References: <200708221210.36770.scldad@sdc.com.au> <46CC16F3.7060606@pws.com.au> <200708230900.13878.scldad@sdc.com.au> Mime-Version: 1.0 (Apple Message framework v752.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: Russell Smith , pgsql-performance@postgresql.org Content-Transfer-Encoding: 7bit From: Michael Glaesemann Subject: Re: Optimising "in" queries Date: Wed, 22 Aug 2007 19:21:05 -0500 To: Stephen Davies X-Mailer: Apple Mail (2.752.2) X-Chzlrs: 0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/256 X-Sequence-Number: 26386 [Please don't top post as it makes the discussion more difficult to follow.] On Aug 22, 2007, at 18:30 , Stephen Davies wrote: > I have always thought of array processing as the thing that vector > processors such as Cray and ETA do/did. (I've always heard that referred to as vector processing.) > While superficially equivalent, I have always believed that IN (a,b,c) > executed faster than =a or =b or =c. Am I wrong for PostgreSQL? Depending on the numbers of the IN list and other statistcs, I believe PostgreSQL will rewrite z in IN (a, b, ...) into either (z = a) OR (z = b) OR ... or somehow add it to the join list, so performance will vary. Michael Glaesemann grzm seespotcode net