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?
|
| Список | 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 по дате отправления: