Re: Is there any method to keep table in memory at startup

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: Is there any method to keep table in memory at startup
Дата
Msg-id 1771.24.211.141.25.1083848817.squirrel@www.dunslane.net
обсуждение исходный текст
Ответ на Re: Is there any method to keep table in memory at startup  (Vinay Jain <vinayj@sarathi.ncst.ernet.in>)
Ответы Re: Is there any method to keep table in memory at startup
Список pgsql-hackers
Vinay Jain said:
> hi
> ya  function is declared immutable and strict... also made btree
> index..


The docs state this about immutable functions:


IMMUTABLE indicates that the function always returns the same result when
given the same argument values; that is, it does not do database lookups
or otherwise use information not directly present in its argument list.


So it appears you are lying to postgres when you declare your function to
be immutable, because you are doing a database lookup.

Why not just code your lookup table as static data immediately available
to your function, and look it up from C directly, rather than using a
database table? Then your function could be genuinely immutable (and fast).

cheers

andrew






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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Fixing the Turkish problem
Следующее
От: Vinay Jain
Дата:
Сообщение: Re: Is there any method to keep table in memory at startup