Re: [SQL] More efficient OR

2005-02-16 Thread PFC
You sound like you don't like the performance you get with OR or IN, from this I deduce that you have a very large list of values to OR from. These make huge queries which are not necessarily very fast ; also they are un-preparable by their very nature (ie. the planner has to look at each

Re: [SQL] More efficient OR

2005-02-16 Thread KÖPFERL Robert
At least for between, I read that pgSQL rewrites it to a (a -Original Message- > From: Keith Worthington [mailto:[EMAIL PROTECTED] > Sent: Mittwoch, 16. Februar 2005 17:36 > To: PostgreSQL SQL > Cc: Sean Davis; Scott Marlowe > Subject: Re: [SQL] More efficient OR >

Re: [SQL] More efficient OR

2005-02-16 Thread Keith Worthington
> > 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 functionali

Re: [SQL] More efficient OR

2005-02-16 Thread Sean Davis
Could 'in' or 'between' do what you want? I know that using 'in' is equivalent to what you have below. Could 'between' be more efficient--you could do explain analyze on various options to see what the actual plan would be. Sean On Feb 16, 2005, at 11:02 AM, Keith Worthington wrote: Hi All, I

Re: [SQL] More efficient OR

2005-02-16 Thread Scott Marlowe
On Wed, 2005-02-16 at 10:02, 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 accomplis

Re: [SQL] More efficient OR

2005-02-16 Thread Reinoud van Leeuwen
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 t

[SQL] More efficient OR

2005-02-16 Thread Keith Worthington
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? Kind Regards, Keith ---