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

From Tom Lane
Subject Re: unexpected stable function behavior
Date
Msg-id 12872.1300123053@sss.pgh.pa.us
Whole thread Raw
In response to Re: unexpected stable function behavior  (Julius Tuskenis <julius@nsoft.lt>)
Responses Re: unexpected stable function behavior  (Julius Tuskenis <julius@nsoft.lt>)
List pgsql-performance
Julius Tuskenis <julius@nsoft.lt> writes:
>  From the postgresql documentation about STABLE functions: "This
> category allows the optimizer to optimize multiple calls of the function
> to a single call." I thought that this means that optimizer executes the
> function only for now parameter sets and stores results in some "cache"
> and use it if the parameters are already known.

No, it does not.  That function property *allows* the optimizer to
invoke the function fewer times than would happen in an un-optimized
query.  It does not *require* it to do so.  There is no such cache
mechanism in Postgres, and it's unlikely that there ever will be,
because it probably would be a net performance loss on average.

            regards, tom lane

pgsql-performance by date:

Previous
From: "John Surcombe"
Date:
Subject: Re: Planner wrongly shuns multi-column index for select .. order by col1, col2 limit 1
Next
From: Claudio Freire
Date:
Subject: Bug in the planner?