Re: bad selectivity estimates for CASE

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: bad selectivity estimates for CASE
Дата
Msg-id 7832.1231248120@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: bad selectivity estimates for CASE  ("Robert Haas" <robertmhaas@gmail.com>)
Список pgsql-performance
"Robert Haas" <robertmhaas@gmail.com> writes:
> Well, presumably CASE WHEN <expr1> THEN <constant1> WHEN <expr2> THEN
> <constant2> WHEN <expr3> THEN <constant3> ... END = <constantn> could
> be simplified to <exprn>.

Not without breaking the order-of-evaluation guarantees.  Consider

    case when x=0 then 0 when 1/x = 42 then 1 end = 1

This expression should not suffer a divide-by-zero failure but your
proposal would allow it to do so.

            regards, tom lane

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

Предыдущее
От: "Robert Haas"
Дата:
Сообщение: Re: bad selectivity estimates for CASE
Следующее
От: Stefano Nichele
Дата:
Сообщение: understanding postgres issues/bottlenecks