Re: unexpected stable function behavior

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Julius Tuskenis <julius(at)nsoft(dot)lt>
Cc: Merlin Moncure <mmoncure(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: unexpected stable function behavior
Date: 2011-03-14 17:17:33
Message-ID: 12872.1300123053@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Claudio Freire 2011-03-14 17:24:31 Bug in the planner?
Previous Message Samba GUEYE 2011-03-14 16:42:06 Re: Table partitioning problem