Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 8C2D61337B90 for ; Fri, 15 Oct 2010 23:31:43 -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 16570-07; Sat, 16 Oct 2010 02:31:36 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 20B6D1337B8C; Fri, 15 Oct 2010 23:31:35 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o9G2VZqm026736; Fri, 15 Oct 2010 22:31:35 -0400 (EDT) To: Tatsuo Ishii cc: mmoncure@gmail.com, damon@huddler-inc.com, pgsql-performance@postgresql.org Subject: Re: Stored procedure declared as VOLATILE => no good optimization is done In-reply-to: <20101016.104738.1076064300636336418.t-ishii@sraoss.co.jp> References: <20101016.104738.1076064300636336418.t-ishii@sraoss.co.jp> Comments: In-reply-to Tatsuo Ishii message dated "Sat, 16 Oct 2010 10:47:38 +0900" Date: Fri, 15 Oct 2010 22:31:34 -0400 Message-ID: <26735.1287196294@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/268 X-Sequence-Number: 40686 Tatsuo Ishii writes: > So can I say "if a function is marked IMMUTABLE, then it should never > modify database"? Is there any counter example? > It seems if above is correct, I can say STABLE functions should never > modify databases as well. Both of those things are explicitly stated here: http://developer.postgresql.org/pgdocs/postgres/xfunc-volatility.html regards, tom lane