Search Postgresql Archives

Re: why VOLATILE attribute is required?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 22 September 2011 16:29, Rafal Pietrak <rafal@xxxxxxxxxxxxxxxxxx> wrote:
On Thu, 2011-09-22 at 07:50 -0500, Merlin Moncure wrote:
> On Thu, Sep 22, 2011 at 5:28 AM, Rafal Pietrak <rafal@xxxxxxxxxxxxxxxxxx> wrote:
>
> if you change the state of the database, including (and especially)
> system catalogs, your function is volatile, period.

Hmmm. To quote from the online documentation:

"VOLATILE indicates that the function value can change even within a
single table scan"

this funciton return value does not change. Further we read:

"any function that has side-effects must be classified volatile, even if
its result is quite predictable, to prevent calls from being optimized
away;"

Well. In this caase, I'd like it being optimised away. This is the
expected result. And the above documentation fragment states it as only
a precausion, not an ERROR.

Are there other reasons for that ERROR (e.g. not a warrning)?

Yes, the reason is that caching that function could be a problem.

And why do you want to optimize that? 
Does it take too much time, or do you want to call that thousands of times?
Have you checked how much the function lasts?
 


regards
Szymon


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux