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 ED0B7D1C938 for ; Tue, 29 Jul 2003 21:32:14 +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 99014-07 for ; Tue, 29 Jul 2003 18:31:16 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id EE9A3D1C949 for ; Tue, 29 Jul 2003 18:32:12 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.9/8.12.9) with ESMTP id h6TLWFQ3004579; Tue, 29 Jul 2003 17:32:15 -0400 (EDT) To: Rajesh Kumar Mallah Cc: pgsql-performance@postgresql.org Subject: Re: Why performance improvement on converting subselect to a function ? In-reply-to: <3F26A503.3050104@trade-india.com> References: <200307291114.29567.mallah@trade-india.com> <21657.1059487755@sss.pgh.pa.us> <3F26A503.3050104@trade-india.com> Comments: In-reply-to Rajesh Kumar Mallah message dated "Tue, 29 Jul 2003 22:16:59 +0530" Date: Tue, 29 Jul 2003 17:32:14 -0400 Message-ID: <4578.1059514334@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/474 X-Sequence-Number: 2767 Rajesh Kumar Mallah writes: > Tom Lane wrote: >> Odd. Apparently the planner is picking a better plan in the function >> context than in the subselect context --- which is strange since it >> ought to have less information. > [ verbose plan snipped ] Well, that sure seems to be the same plan. Curious that the runtime wasn't about the same. Perhaps the slow execution of the first query was a caching effect? If you alternate trying the query both ways, does the speed difference persist? regards, tom lane