Re: Should planner fold "stable" functions for estimation purposes?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Should planner fold "stable" functions for estimation purposes?
Дата
Msg-id 13889.1079139840@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Should planner fold "stable" functions for estimation purposes?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Rod Taylor <rbt@rbt.ca> writes:
>> It would not be correct to reduce the righthand side to a constant in
>> advance of execution, of course, but is it reasonable to compute its
>> current value solely for purposes of comparison to column statistics?

> So this means it would be double evaluated? A flag will be required to
> prevent this for functions that do more than just return a value or have
> a high cost in execution.

Functions with side-effects had better be marked volatile anyway, so I'm
not worried about that case.  As for the expense argument, keep in mind
that the one extra evaluation in the planner is likely to save you an
awful lot of evaluations at runtime, if it convinces the planner to use
an indexscan and not a seqscan.  We are after all talking about
functions appearing in WHERE, and I wouldn't think that people can
reasonably expect those to get evaluated just once.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Should planner fold "stable" functions for estimation purposes?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Log rotation