Re: unexpected stable function behavior - Mailing list pgsql-performance

From Andres Freund
Subject Re: unexpected stable function behavior
Date
Msg-id 201103141508.15229.andres@anarazel.de
Whole thread Raw
In response to unexpected stable function behavior  (Julius Tuskenis <julius@nsoft.lt>)
List pgsql-performance
On Thursday, March 10, 2011 05:26:00 PM Julius Tuskenis wrote:
> 3) As STABLE function should be executed once for every different set of
> parameters
Thats not true. Thats not what any of the volatility information (like STABLE,
IMMUTABLE, VOLATILE) does.

See http://www.postgresql.org/docs/current/interactive/xfunc-volatility.html

It *does* change how often a function is executed though. I.e.

SELECT g.i, some_stable_func(1) FROM generate_series(1, 1000) g(i)

will call some_stable_func only once because it can determine all the
parameters beforehand.


Andres

pgsql-performance by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: unexpected stable function behavior
Next
From: Claudio Freire
Date:
Subject: Re: Performance regression from 8.3.7 to 9.0.3