Re: [SQL] Simple Optimization Problem

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [SQL] Simple Optimization Problem
Дата
Msg-id 7551.926353766@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [SQL] Simple Optimization Problem  (Bruce Momjian <maillist@candle.pha.pa.us>)
Список pgsql-sql
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


В списке pgsql-sql по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [SQL] Confusion about DISTINCT.
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [SQL] Strange behavior