Re: Expression transformation curiosity

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Expression transformation curiosity
Дата
Msg-id 11422.1061133781@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Expression transformation curiosity  (Richard Huxton <dev@archonet.com>)
Список pgsql-sql
Richard Huxton <dev@archonet.com> writes:
> Boiling the problem down, I've looked at a clause of the form:
>   a OR (b AND c)
> which PG converts to:
>   (a OR b) AND (a OR c)

> Is it an artefact of displaying the EXPLAIN, or is it actually
> processed that way? You could see how testing "a" twice could be
> expensive in some situations.

It's actually done that way --- see the comments near the head of
src/backend/optimizer/prep/prepqual.c.  There are some heuristics
to not do it if the expression expands "a lot", though.
        regards, tom lane


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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Expression transformation curiosity
Следующее
От: "Alexander M. Pravking"
Дата:
Сообщение: Re: Expression transformation curiosity