pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Julius Tuskenis <julius@nsoft.lt>
Cc: Merlin Moncure <mmoncure@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: unexpected stable function behavior
Date: Mon, 14 Mar 2011 13:17:33 -0400
Message-ID: <12872.1300123053@sss.pgh.pa.us> (raw)
In-Reply-To: <4D7DD5CF.4080502@nsoft.lt>
References: <4D78FB98.7090609@nsoft.lt>
	<AANLkTimTR_f98H4+h57iW6-S=BjZaMTSQ6VznRgXU5Ly@mail.gmail.com>
	<4D7DD5CF.4080502@nsoft.lt>

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



view thread (8+ messages)  latest in thread

Message-ID: <12872.1300123053@sss.pgh.pa.us>
Permalink:  ../12872.1300123053@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/12872.1300123053@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, julius@nsoft.lt, mmoncure@gmail.com
  Subject: Re: unexpected stable function behavior
  In-Reply-To: <12872.1300123053@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox