Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 77B4563483E for ; Mon, 8 Jun 2009 14:34:24 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 84937-01-2 for ; Mon, 8 Jun 2009 14:34:22 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from relay.pcl-ipout01.plus.net (relay.pcl-ipout01.plus.net [212.159.7.99]) by mail.postgresql.org (Postfix) with ESMTP id CF115635F6F for ; Mon, 8 Jun 2009 14:34:05 -0300 (ADT) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAKPoLErUnw4U/2dsb2JhbADOQoQKBQ Received: from pih-relay08.plus.net ([212.159.14.20]) by relay.pcl-ipout01.plus.net with ESMTP; 08 Jun 2009 18:34:04 +0100 Received: from [84.51.143.99] (helo=server3.office.archonet.com) by pih-relay08.plus.net with esmtp (Exim) id 1MDijT-0007xM-O5; Mon, 08 Jun 2009 18:34:03 +0100 Received: from dell36.office.archonet.com (dell36.office.archonet.com [192.168.1.36]) by server3.office.archonet.com (Postfix) with ESMTP id 74465274046; Mon, 8 Jun 2009 18:34:03 +0100 (BST) Message-ID: <4A2D4B8B.1080501@archonet.com> Date: Mon, 08 Jun 2009 18:34:03 +0100 From: Richard Huxton User-Agent: Thunderbird 2.0.0.21 (X11/20090320) MIME-Version: 1.0 To: Rob Sargent , PostgreSQL Subject: Re: 'cost' and 'rows' for volitile function References: <4A2D3B9D.1040909@gmail.com> <4A2D44EB.7030108@archonet.com> <4A2D476B.5030404@gmail.com> In-Reply-To: <4A2D476B.5030404@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Plusnet-Relay: b23ab94123862a3df588de6a89118eb8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200906/33 X-Sequence-Number: 32638 Rob Sargent wrote: > Richard Huxton wrote: >> Rob Sargent wrote: >>> pg-admin is showing 'COST 100' and 'ROWS 1000' for my explicitly >>> VOLATILE functions. > Thanks for the pointer back to CREATE FUNCTION docs. That would have > told me that those value are indeed the defaults. I guess I'm somewhat > surprised that they are in fact defautled. "COST" is too arbitrary for > me to comment on, but my functions' results sets fall on both sides of > 1000 rows, so I'm not sure giving this value to the planner does a lot > of good. Luckily, my functions are typically pretty much stand-alone > calls, and not part of some larger query. If your functions are all called at the top-level then indeed it doesn't matter. At a low level though, telling the planner function F1 costs 1000 times more than F2 is useful. -- Richard Huxton Archonet Ltd