X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 30DE88BA111 for ; Wed, 16 Feb 2005 16:15:20 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 73843-09 for ; Wed, 16 Feb 2005 16:15:11 +0000 (GMT) Received: from spoetnik.xs4all.nl (spoetnik.xs4all.nl [213.84.24.58]) by svr1.postgresql.org (Postfix) with ESMTP id 9B9368BA37E for ; Wed, 16 Feb 2005 16:15:09 +0000 (GMT) Received: by spoetnik.xs4all.nl (Postfix, from userid 1000) id 6B2601CC76; Wed, 16 Feb 2005 17:15:08 +0100 (CET) Date: Wed, 16 Feb 2005 17:15:08 +0100 From: Reinoud van Leeuwen To: PostgreSQL SQL Subject: Re: More efficient OR Message-ID: <20050216161508.GW4705@spoetnik.xs4all.nl> Mail-Followup-To: PostgreSQL SQL References: <20050216155901.M41773@narrowpathinc.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050216155901.M41773@narrowpathinc.com> User-Agent: Mutt/1.4.2.1i X-message-flag: Warning! The sender of this mail thinks you should use a more secure email client. X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200502/161 X-Sequence-Number: 20272 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 __________________________________________________