From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | josh(at)agliodbs(dot)com |
Cc: | Scott Cain <cain(at)cshl(dot)org>, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: OR vs UNION |
Date: | 2003-07-17 19:24:59 |
Message-ID: | 6219.1058469899@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Josh Berkus <josh(at)agliodbs(dot)com> 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 didn't really preserve
semantics exactly --- IIRC, should you mention the same field value more
than once in the OR, the UNION ALL version would generate duplicate
output rows. At the time it was put in, it offered significant
performance wins, but subsequent planner improvements narrowed the gap
to nearly nothing, and we eventually took it out. I'm not sure whether
there's any possible win given the current state of the planner.
If you dig for "ksqo" in the archives you can find all the details
(at least on days when the search engine is working ;-)).
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2003-07-17 19:38:42 | Re: Table Partitioning and Rules |
Previous Message | Girish Bajaj | 2003-07-17 19:22:41 | Re: Table Partitioning and Rules |