Re: Can this function be declared IMMUTABLE?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Can this function be declared IMMUTABLE?
Дата
Msg-id 410.1188322832@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Can this function be declared IMMUTABLE?  (beickhof@Lexmark.com)
Ответы Re: Can this function be declared IMMUTABLE?  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-general
beickhof@Lexmark.com writes:
> Well, I am considering a function that does select from a table, but the
> table contents change extremely infrequently (the table is practically a
> list of constants).  Would it be safe to declare the function IMMUTABLE
> provided that the table itself is endowed with a trigger that will drop
> and recreate the function any time the table contents are modified?

What you'd want to do is restart all existing sessions so that any plans
made using precomputed function values are discarded.  The trigger you
suggest is fairly pointless because it will not cause regeneration of
plans.

I concur with Bill's remark that you should first determine if there's
a really substantial benefit to marking the function immutable rather
than merely stable.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Indexing Foreign Key Columns
Следующее
От: Tom Lane
Дата:
Сообщение: Re: 8.1.10 release?