Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 750439F9BA8 for ; Thu, 23 Aug 2007 16:46:55 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 02849-07 for ; Thu, 23 Aug 2007 16:46:48 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id D736F9F9AE7 for ; Thu, 23 Aug 2007 16:46:50 -0300 (ADT) Received: from perhan.alvh.no-ip.org (201-221-221-172.bk12-dsl.surnet.cl [201.221.221.172]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l7NJkkvN024480; Thu, 23 Aug 2007 12:46:47 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 5830447C5B; Thu, 23 Aug 2007 15:46:42 -0400 (CLT) Date: Thu, 23 Aug 2007 15:46:42 -0400 From: Alvaro Herrera To: Stephen Davies Cc: Michael Glaesemann , Russell Smith , pgsql-performance@postgresql.org Subject: Re: Optimising "in" queries Message-ID: <20070823194642.GD31461@alvh.no-ip.org> References: <200708221210.36770.scldad@sdc.com.au> <46CC16F3.7060606@pws.com.au> <200708230900.13878.scldad@sdc.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200708230900.13878.scldad@sdc.com.au> User-Agent: Mutt/1.5.16 (2007-06-11) X-Virus-Scanned: ClamAV 0.91.1/4032/Wed Aug 22 13:15:27 2007 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Thu, 23 Aug 2007 12:46:50 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/274 X-Sequence-Number: 26404 Stephen Davies wrote: > Interesting semantics. I have never seen the IN syntax referred to as > "array processing" before. > > I have always thought of array processing as the thing that vector > processors such as Cray and ETA do/did. > > 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? Older versions of Postgres translated IN (a, b, c) into an OR'ed list of equalities. Nowadays it is treated as an array; I think it's translated to = ANY ({a,b,c}), as you can see in the message you posted at the start of this thread. I don't think you showed us the EXPLAIN ANALYZE results that Scott requested. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support