Re: Optimising "in" queries - Mailing list pgsql-performance

From Alvaro Herrera
Subject Re: Optimising "in" queries
Date
Msg-id 20070823194642.GD31461@alvh.no-ip.org
Whole thread Raw
In response to Re: Optimising "in" queries  (Stephen Davies <scldad@sdc.com.au>)
Responses Re: Optimising "in" queries
Re: Optimising "in" queries
List 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
requested.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

pgsql-performance by date:

Previous
From: Tom Lane
Date:
Subject: Re: long-running query - needs tuning
Next
From: Decibel!
Date:
Subject: Re: Raid Configurations