Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 2B4C81337D02 for ; Wed, 23 Mar 2011 21:06:13 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 29598-10 for ; Thu, 24 Mar 2011 00:06:04 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outmail148153.authsmtp.net (outmail148153.authsmtp.net [62.13.148.153]) by mail.postgresql.org (Postfix) with ESMTP id DA8901337C10 for ; Wed, 23 Mar 2011 21:05:17 -0300 (ADT) Received: from mail-c193.authsmtp.com (mail-c193.authsmtp.com [62.13.128.118]) by punt10.authsmtp.com (8.14.2/8.14.2/Kp) with ESMTP id p2O05EXm021472; Thu, 24 Mar 2011 00:05:14 GMT Received: from Sidney-Stratton.local (dsl081-245-111.sfo1.dsl.speakeasy.net [64.81.245.111]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2) with ESMTP id p2O05C7U063475; Thu, 24 Mar 2011 00:05:13 GMT Message-ID: <4D8A8AB8.7040401@agliodbs.com> Date: Wed, 23 Mar 2011 17:05:12 -0700 From: Josh Berkus User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.1b3pre) Gecko/20090223 Thunderbird/3.0b2 MIME-Version: 1.0 To: Tom Lane CC: Claudio Freire , postgres performance list Subject: Re: Shouldn't we have a way to avoid "risky" plans? References: <4D8A29F2.9080105@agliodbs.com> <4D8A581D.5080704@agliodbs.com> <4286.1300914004@sss.pgh.pa.us> In-Reply-To: <4286.1300914004@sss.pgh.pa.us> X-Enigmail-Version: 0.97a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Server-Quench: 64906002-55aa-11e0-97bb-002264978518 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCdyZgscClZXSx8a IioLCC5HRQ8+YBZL BAkGMA9GIUINWEQK c1AAch12OUdbHwkA AnYLW15UVVdwXS1z bxRZbBtfZk9QXgRr T0pMQFdNFEsoA2MB A20ZNxl0dAFBfTB2 Y0RlEHZfVUR8dUZ/ X0tRRDwbZGY1aH0W VxIKagNUcgFMehZC YlV+XD1vNG8XDRoV JSEUBRUEdQ5fLzlR TgdCMRoNTA4LFyAx DxlKAjw+VVECDywt KB0qYhQGHV0SIw96 KV8oX0lPWwAB X-Authentic-SMTP: 61633136333939.1014:706 X-AuthFastPath: 0 (Was 255) X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201103/299 X-Sequence-Number: 42978 > If the planner starts operating on the basis of worst case rather than > expected-case performance, the complaints will be far more numerous than > they are today. Yeah, I don't think that's the way to go. The other thought I had was to accumulate a "risk" stat the same as we accumulate a "cost" stat. However, I'm thinking that I'm overengineering what seems to be a fairly isolated problem, in that we might simply need to adjust the costing on this kind of a plan. Also, can I say that the cost figures in this plan are extremely confusing? Is it really necessary to show them the way we do? Merge Join (cost=29.16..1648.00 rows=382 width=78) (actual time=57215.167..57215.216 rows=1 loops=1) Merge Cond: (rn.node_id = device_nodes.node_id) -> Nested Loop (cost=0.00..11301882.40 rows=6998 width=62) (actual time=57209.291..57215.030 rows=112 loops=1) Join Filter: (node_ep.node_id = rn.node_id) -> Nested Loop (cost=0.00..11003966.85 rows=90276 width=46) (actual time=0.027..52792.422 rows=90195 loops=1) The first time I saw the above, I thought we had some kind of glibc math bug on the host system. Costs are supposed to accumulate upwards. -- -- Josh Berkus PostgreSQL Experts Inc. http://www.pgexperts.com