X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id A9DDED1B4E2 for ; Wed, 8 Oct 2003 22:23:29 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 56083-07 for ; Wed, 8 Oct 2003 19:22:43 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id 60847D1B556 for ; Wed, 8 Oct 2003 19:22:40 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h98MMXhn005443; Wed, 8 Oct 2003 18:22:34 -0400 (EDT) To: Andriy Tkachuk Cc: pgsql-performance@postgresql.org Subject: Re: IMMUTABLE function's flag do not work: 7.3.4, plpgsql In-reply-to: <20031008152741.P17672-100000@pool.imt.com.ua> References: <20031008152741.P17672-100000@pool.imt.com.ua> Comments: In-reply-to Andriy Tkachuk message dated "Wed, 08 Oct 2003 16:16:52 +0300" Date: Wed, 08 Oct 2003 18:22:32 -0400 Message-ID: <5442.1065651752@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/248 X-Sequence-Number: 3996 Andriy Tkachuk writes: > At second. calc_total() is immutable function: > but it seems that it's not cached in one session: It's not supposed to be. The reason the "runtime" is small in your example is that the planner executes the function call while preparing the plan, and this isn't counted in EXPLAIN's runtime measurement. There's no claim anywhere that the results of such an evaluation would be saved for other plans. regards, tom lane