Re: Does IMMUTABLE property propagate?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Does IMMUTABLE property propagate?
Дата
Msg-id 16800.1269527726@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Does IMMUTABLE property propagate?  (Louis-David Mitterrand <vindex+lists-pgsql-sql@apartia.org>)
Ответы Re: Does IMMUTABLE property propagate?  (Greg Stark <gsstark@mit.edu>)
Список pgsql-sql
Louis-David Mitterrand <vindex+lists-pgsql-sql@apartia.org> writes:
> Hmm, that's interesting. So for simple functions (like my example) it is
> better to write them in plain sql? And in that case no 'immutable' flag
> is necessary?

If it's just a simple SQL expression, then yes write it as a SQL
function.  The planner can "inline" those, eliminating the call overhead
that you'll pay with a plpgsql function.

When you're intending to have a SQL function be inlined, it's probably
best not to mark it as either IMMUTABLE or STRICT --- that doesn't buy
anything and it can complicate matters as to whether inlining is legal.
        regards, tom lane


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

Предыдущее
От: David Harel
Дата:
Сообщение: Capacity planning.
Следующее
От: Leif Biberg Kristensen
Дата:
Сообщение: Re: Plpgsql: Iterating through a string of parameters