From: Gaetano Mendola <mendola@bigfoot.com>
To: pgsql-performance@postgresql.org <pgsql-performance@postgresql.org>
Cc: Andriy Tkachuk <ant@imt.com.ua>
Subject: Re: IMMUTABLE function's flag do not work: 7.3.4, plpgsql
Date: Sun, 12 Oct 2003 23:28:56 +0200
Message-ID: <3F89C798.4090402@bigfoot.com> (raw)
In-Reply-To: <20031010101408.G35607-100000@pool.imt.com.ua>
References: <3F858FCE.3040907@bigfoot.com>
<20031010101408.G35607-100000@pool.imt.com.ua>
Andriy Tkachuk wrote:
> On Thu, 9 Oct 2003, Gaetano Mendola wrote:
>>Andriy Tkachuk wrote:
>>>On Wed, 8 Oct 2003, Tom Lane wrote:
>>>>Andriy Tkachuk <ant@imt.com.ua> writes:
>>>>>At second. calc_total() is immutable function:
>>>>>but it seems that it's not cached in one session:
>>>>
>>>>It's not supposed to be.
>>>
>>>
>>>but it's written id doc:
>>>
>>> IMMUTABLE indicates that the function always returns the same
>>> result when given the same argument values; that is, it does not
>>> do database lookups or otherwise use information not directly
>>> present in its parameter list. If this option is given, any call
>>> of the function with all-constant arguments can be immediately
>>> replaced with the function value.
>>
>>The doc say "can be" not must and will be.
>
>
> ok, but on what it depends on?
For example in:
select * from T where f_immutable ( 4 ) = T.id;
in this case f_immutable will be evaluated once.
select * from T where f_immutable ( T.id ) = X;
here f_immutable will be avaluated for each different T.id.
Regards
Gaetano Mendola
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: mendola@bigfoot.com, ant@imt.com.ua
Subject: Re: IMMUTABLE function's flag do not work: 7.3.4, plpgsql
In-Reply-To: <3F89C798.4090402@bigfoot.com>
* 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