Bruce Momjian <maillist@candle.pha.pa.us> writes:
> I have added this to our TODO list as:
> process const=const parts of OR clause first
I think that would be quite the wrong way to approach it. What we
need is a general-purpose rewriter phase that tries to evaluate
constant subexpressions, and is applied after the rest of rewrite
but before planner/optimizer. In this case
select * from po where (po_id=8888 or 0=8888);
would be reduced to
select * from po where (po_id=8888 or FALSE);
and then
select * from po where (po_id=8888);
which the optimizer knows what to do with. (cnfify() does some of this
but not enough.)
>> Is there any hope in 6.5 of the optimizer
>> handling this better?
Not for 6.5. 6.6 or 6.7 maybe...
regards, tom lane