Julius Tuskenis <julius(at)nsoft(dot)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