X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id CD52B52934 for ; Thu, 23 Jun 2005 12:00:43 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60557-07 for ; Thu, 23 Jun 2005 15:00:37 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 571E95285C for ; Thu, 23 Jun 2005 12:00:35 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j5NF0O3d078386 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 23 Jun 2005 09:00:27 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j5NF0NqQ036842; Thu, 23 Jun 2005 09:00:23 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j5NF0NXH036841; Thu, 23 Jun 2005 09:00:23 -0600 (MDT) (envelope-from mfuhr) Date: Thu, 23 Jun 2005 09:00:23 -0600 From: Michael Fuhr To: Donald Fraser Cc: "[ADMIN]" Subject: Re: Are cached IMMUTABLE values persistent between sessions Message-ID: <20050623150023.GA36745@winnie.fuhr.org> References: <002301c577f7$28141780$6364a8c0@DonAcer> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <002301c577f7$28141780$6364a8c0@DonAcer> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.005 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/171 X-Sequence-Number: 17926 On Thu, Jun 23, 2005 at 02:26:23PM +0100, Donald Fraser wrote: > > Is the returned value of a function defined as IMMUTABLE cached > globally? In other words could postgresql potentially return a > cached value obtained from one client session to a different client > session? You could experiment with this by adding a debugging RAISE statement to an IMMUTABLE PL/pgSQL function to see when it's called. I suspect there's no global caching; if there is then I haven't been able to make it happen in tests. There doesn't even appear to be any caching between disparate queries in the same session unless a prepared plan is involved (e.g., a plan made with PREPARE or a cached plan from a PL/pgSQL function) and the result of the IMMUTABLE function could be determined at planning time. -- Michael Fuhr http://www.fuhr.org/~mfuhr/