X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2B0D3D1B4E1 for ; Sun, 12 Oct 2003 23:29:26 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 61090-07 for ; Sun, 12 Oct 2003 20:28:56 -0300 (ADT) Received: from smtp.noos.fr (nan-smtp-12.noos.net [212.198.2.83]) by svr1.postgresql.org (Postfix) with ESMTP id D62F9D1B4EF for ; Sun, 12 Oct 2003 20:28:36 -0300 (ADT) Received: (qmail 11591654 invoked by uid 0); 12 Oct 2003 23:29:00 -0000 Received: from unknown (HELO bigfoot.com) ([212.198.37.110]) (envelope-sender ) by 212.198.2.83 (qmail-ldap-1.03) with SMTP for ; 12 Oct 2003 23:29:00 -0000 Message-ID: <3F89C798.4090402@bigfoot.com> Date: Sun, 12 Oct 2003 23:28:56 +0200 From: Gaetano Mendola User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030901 Thunderbird/0.2 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "pgsql-performance@postgresql.org" Cc: Andriy Tkachuk Subject: Re: IMMUTABLE function's flag do not work: 7.3.4, plpgsql References: <3F858FCE.3040907@bigfoot.com> <20031010101408.G35607-100000@pool.imt.com.ua> In-Reply-To: <20031010101408.G35607-100000@pool.imt.com.ua> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/404 X-Sequence-Number: 4152 Andriy Tkachuk wrote: > On Thu, 9 Oct 2003, Gaetano Mendola wrote: >>Andriy Tkachuk wrote: >>>On Wed, 8 Oct 2003, Tom Lane wrote: >>>>Andriy Tkachuk 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