Re: [SQL] OR vs UNION

2003-07-21 Thread Bruce Momjian
mes certainly, and in this case it made things much > better... > > Terry Fielder > Manager Software Development and Deployment > Great Gulf Homes / Ashton Woods Homes > [EMAIL PROTECTED] > Fax: (416) 441-9085 > > > > -Original Message- > > From: [EMAIL

Re: [SQL] OR vs UNION

2003-07-17 Thread terry
ter... Terry Fielder Manager Software Development and Deployment Great Gulf Homes / Ashton Woods Homes [EMAIL PROTECTED] Fax: (416) 441-9085 > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of Josh Berkus > Sent: Thursday, July 17, 2003 3:00 PM &g

Re: [SQL] OR vs UNION

2003-07-17 Thread Tom Lane
Josh Berkus <[EMAIL PROTECTED]> writes: > Certainly a query of the above form would not benefit from being a union. Actually we used to have code in the planner that would automatically transform an OR query to a UNION ALL construct (the old "ksqo" option). It fell into disfavor, partly because it

Re: [SQL] OR vs UNION

2003-07-17 Thread Scott Cain
On Thu, 2003-07-17 at 15:00, Josh Berkus wrote: > Scott, > > > I have a query that uses a series of ORs and I have heard that sometimes > > this type of query can be rewritten to use UNION instead and be more > > efficient. > > I'd be interested to know where you heard that; as far as I know, i

Re: [SQL] OR vs UNION

2003-07-17 Thread Josh Berkus
Scott, > I have a query that uses a series of ORs and I have heard that sometimes > this type of query can be rewritten to use UNION instead and be more > efficient. I'd be interested to know where you heard that; as far as I know, it could only apply to conditional left outer joins. > s

[SQL] OR vs UNION

2003-07-17 Thread Scott Cain
Hello, I have a query that uses a series of ORs and I have heard that sometimes this type of query can be rewritten to use UNION instead and be more efficient. Are there any rules of thumb for when this might be the case? As an example here is a query of the type I am discussing: select di