Re: More efficient OR

From: Reinoud van Leeuwen <reinoud(dot)v(at)n(dot)leeuwen(dot)net>
To: PostgreSQL SQL <pgsql-sql(at)postgresql(dot)org>
Subject: Re: More efficient OR
Date: 2005-02-16 16:15:08
Message-ID: 20050216161508.GW4705@spoetnik.xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, Feb 16, 2005 at 11:02:59AM -0500, Keith Worthington wrote:
> Hi All,
>
> In several of my SQL statements I have to use a WHERE clause that contains
> mutiple ORs. i.e.
>
> WHERE column1 = 'A' OR
> column1 = 'B' OR
> column1 = 'C'
>
> Is there a more efficient SQL statement that accomplishes the same limiting
> functionality?

I do not know wheter it is more efficient in terms of execution, but I can
read this more efficiently:

WHERE column1 in ('A', 'B', 'C')

--
__________________________________________________
"Nothing is as subjective as reality"
Reinoud van Leeuwen reinoud(dot)v(at)n(dot)leeuwen(dot)net
http://www.xs4all.nl/~reinoud
__________________________________________________

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Scott Marlowe 2005-02-16 16:15:15 Re: More efficient OR
Previous Message Keith Worthington 2005-02-16 16:02:59 More efficient OR