Re: IMMUTABLE STABLE functions, daily updates

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема Re: IMMUTABLE STABLE functions, daily updates
Дата
Msg-id CAD2md3GG37L69TXLx5fu9kPDseDEGrGTdabCX0uzoXm4Cr+zkA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: IMMUTABLE STABLE functions, daily updates  (Thom Brown <thom@linux.com>)
Список pgsql-performance


On Nov 10, 2011 9:26 PM, "Thom Brown" <thom@linux.com> wrote:
>
> On 10 November 2011 13:05, Sorin Dudui <sd@wigeogis.com> wrote:
> > Hi,
> >
> >
> >
> > I have some functions that select data from tables which are daily or
> > monthly updated.  My functions are marked as STABLE. I am wondering if they
> > perform better if I mark they as IMMUTABLE?
>
> No.  IMMUTABLE is only appropriate when there is no access to table
> data from within the function

Sure it can be faster - the same way defining "fibonacci(int)" to always return 42 is faster, just incorrect.

You can sometimes kinda get away with it if you are willing to reindex, drop prepared statements, reload functions, etc when the result changes. I would not recommend it.

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

Предыдущее
От: Jay Levitt
Дата:
Сообщение: Re: Subquery in a JOIN not getting restricted?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Subquery in a JOIN not getting restricted?