pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Reinoud van Leeuwen <reinoud.v@n.leeuwen.net>
To: PostgreSQL SQL <pgsql-sql@postgresql.org>
Subject: Re: More efficient OR
Date: Wed, 16 Feb 2005 17:15:08 +0100
Message-ID: <20050216161508.GW4705@spoetnik.xs4all.nl> (raw)
In-Reply-To: <20050216155901.M41773@narrowpathinc.com>
References: <20050216155901.M41773@narrowpathinc.com>

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.v@n.leeuwen.net
http://www.xs4all.nl/~reinoud
__________________________________________________



view thread (7+ messages)  latest in thread

Message-ID: <20050216161508.GW4705@spoetnik.xs4all.nl>
Permalink:  ../20050216161508.GW4705@spoetnik.xs4all.nl/
Also on:    postgresql.org/message-id/20050216161508.GW4705@spoetnik.xs4all.nl

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: reinoud.v@n.leeuwen.net
  Subject: Re: More efficient OR
  In-Reply-To: <20050216161508.GW4705@spoetnik.xs4all.nl>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox