Skip site navigation (1) Skip section navigation (2)

Re: Optimising "in" queries

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Stephen Davies <scldad(at)sdc(dot)com(dot)au>
Cc: Michael Glaesemann <grzm(at)seespotcode(dot)net>, Russell Smith <mr-russ(at)pws(dot)com(dot)au>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Optimising "in" queries
Date: 2007-08-23 19:46:42
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
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

Alvaro Herrera                      
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to


pgsql-performance by date

Next:From: Steven FlattDate: 2007-08-23 22:25:25
Subject: Re: When/if to Reindex
Previous:From: Tom LaneDate: 2007-08-23 18:56:19
Subject: Re: long-running query - needs tuning

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group