X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 63E98D1D1A4 for ; Fri, 20 Feb 2004 15:47:32 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 14656-08 for ; Fri, 20 Feb 2004 11:47:33 -0400 (AST) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id F192ED1C511 for ; Fri, 20 Feb 2004 11:47:28 -0400 (AST) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 9E593357DB; Fri, 20 Feb 2004 07:47:33 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 9D3C1357CF; Fri, 20 Feb 2004 07:47:33 -0800 (PST) Date: Fri, 20 Feb 2004 07:47:33 -0800 (PST) From: Stephan Szabo To: Bill Moran Cc: pgsql-performance@postgresql.org Subject: Re: cacheable stored functions? In-Reply-To: <40362944.2060809@potentialtech.com> Message-ID: <20040220074336.G82937@megazone.bigpanda.com> References: <40362944.2060809@potentialtech.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/237 X-Sequence-Number: 5761 On Fri, 20 Feb 2004, Bill Moran wrote: > I'm converting a SQL application to PostgreSQL. The majority of the logic > in this application is in the stored functions in the database. > > Somewhere, I saw a reference to "WITH (iscachable)" for stored functions, > looking again, I'm unable to find any reference to this directive. I have > a single function that is _obviously_ safe to cache using this, and it > generates no errors or problems that I can see. It's been basically superceded by IMMUTABLE, and I believe they're described in the create function reference page. Note that it doesn't involve caching as much as the fact that it can be evaluated once and treated as a constant.