Re: function not called if part of aggregate

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: function not called if part of aggregate
Дата
Msg-id 87ac8jfu7t.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на function not called if part of aggregate  ("Craig A. James" <cjames@modgraph-usa.com>)
Ответы Re: function not called if part of aggregate  ("Craig A. James" <cjames@modgraph-usa.com>)
Список pgsql-performance
"Craig A. James" <cjames@modgraph-usa.com> writes:

> This doesn't seem right to me -- how can the optimizer possibly know that a
> function doesn't have a side effect, as in my case? Functions could do all
> sorts of things, such as logging activity, filling in other tables, etc, etc.

The optimizer can know this if the user tells it so by marking the function
IMMUTABLE. If the function is marked VOLATILE then the optimizer can know it
might have side effects.

However that's not enough to explain what you've shown. How about you show the
actual query and actual plan you're working with? The plan you've shown can't
result from the query you sent.

--
greg

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

Предыдущее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: function not called if part of aggregate
Следующее
От: "Steinar H. Gunderson"
Дата:
Сообщение: Re: scaling up postgres