Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 6D2D61337BE9 for ; Mon, 14 Mar 2011 11:08:26 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 75309-05 for ; Mon, 14 Mar 2011 14:08:19 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.anarazel.de (mail.anarazel.de [217.115.131.40]) by mail.postgresql.org (Postfix) with ESMTP id 01EC81337B5D for ; Mon, 14 Mar 2011 11:08:18 -0300 (ADT) Received: from intern.anarazel.de (p579FABE9.dip.t-dialin.net [87.159.171.233]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPA id 19A10448004; Mon, 14 Mar 2011 15:08:17 +0100 (CET) From: Andres Freund To: pgsql-performance@postgresql.org Subject: Re: unexpected stable function behavior Date: Mon, 14 Mar 2011 15:08:14 +0100 User-Agent: Kmail Cc: Julius Tuskenis References: <4D78FB98.7090609@nsoft.lt> In-Reply-To: <4D78FB98.7090609@nsoft.lt> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201103141508.15229.andres@anarazel.de> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.61 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201103/135 X-Sequence-Number: 42814 On Thursday, March 10, 2011 05:26:00 PM Julius Tuskenis wrote: > 3) As STABLE function should be executed once for every different set of > parameters Thats not true. Thats not what any of the volatility information (like STABLE, IMMUTABLE, VOLATILE) does. See http://www.postgresql.org/docs/current/interactive/xfunc-volatility.html It *does* change how often a function is executed though. I.e. SELECT g.i, some_stable_func(1) FROM generate_series(1, 1000) g(i) will call some_stable_func only once because it can determine all the parameters beforehand. Andres