Re: BUG #5611: SQL Function STABLE promoting to VOLATILE

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #5611: SQL Function STABLE promoting to VOLATILE
Дата
Msg-id 12044.1281561175@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: BUG #5611: SQL Function STABLE promoting to VOLATILE  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: BUG #5611: SQL Function STABLE promoting to VOLATILE  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-bugs
Robert Haas <robertmhaas@gmail.com> writes:
> In theory, the optimization Brian wants is possible here, right?  I
> mean, you could replace the functional call with a Param, and pull the
> Param out and make it an InitPlan.  Seems like that would generally be
> a win, if you figure to loop more than once and the execution cost of
> the function is not too tiny.

Yeah, possibly.  It would probably be difficult for the planner to
figure out where the cutover point is to make that worthwhile, though;
the point where you'd need to make the transformation is long before we
have any rowcount estimates.

I was about to suggest that Brian could make that happen manually
by writing ... FROM srf((SELECT expensive_func())) ... but I think
actually that will just amount to another way of disabling inlining.

            regards, tom lane

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

Предыдущее
От: Brian Ceccarelli
Дата:
Сообщение: Re: BUG #5611: SQL Function STABLE promoting to VOLATILE
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: BUG #5611: SQL Function STABLE promoting to VOLATILE