X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 409B99FA4E1 for ; Tue, 16 May 2006 10:33:46 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 66203-04 for ; Tue, 16 May 2006 10:33:29 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 6FA2F9FA176 for ; Tue, 16 May 2006 10:33:26 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k4GDXE6h011509; Tue, 16 May 2006 09:33:14 -0400 (EDT) To: Joachim Wieland cc: David Wheeler , pgsql-performance Subject: Re: IMMUTABLE? In-reply-to: <20060516094824.GA2376@mcknight.de> References: <2D4C0FA5-DB75-45EA-91D2-7B4F6DD55083@kineticode.com> <5211.1147749711@sss.pgh.pa.us> <3F0CF576-8C6F-433C-9942-BB36F4E1A194@kineticode.com> <5894.1147753901@sss.pgh.pa.us> <20060516094824.GA2376@mcknight.de> Comments: In-reply-to Joachim Wieland message dated "Tue, 16 May 2006 11:48:24 +0200" Date: Tue, 16 May 2006 09:33:14 -0400 Message-ID: <11508.1147786394@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/345 X-Sequence-Number: 19132 Joachim Wieland writes: > So irrespective of caching to prevent evaluation across statements, within a > single statement, is there a strong reason why for example in > WHERE col = f(const) with f() declared as immutable or stable and without an > index on col, f() still gets called for every row? Or is this optimization > just not done yet? The above statement is not correct, at least not for immutable functions. regards, tom lane