X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 386E211F6B93 for ; Fri, 7 Apr 2006 12:25:04 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 60264-02-2 for ; Fri, 7 Apr 2006 12:25:01 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from pih-relay05.plus.net (pih-relay05.plus.net [212.159.14.132]) by postgresql.org (Postfix) with ESMTP id B661311F6B8F for ; Fri, 7 Apr 2006 12:25:00 -0300 (ADT) Received: from [213.162.97.75] (helo=mail.metronet.co.uk) by pih-relay05.plus.net with esmtp (Exim) id 1FRspW-0003IN-9i; Fri, 07 Apr 2006 16:24:58 +0100 Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 6BFB07379E; Fri, 7 Apr 2006 16:26:05 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id 2047BFF04; Fri, 7 Apr 2006 16:24:57 +0100 (BST) Message-ID: <44368448.9090101@archonet.com> Date: Fri, 07 Apr 2006 16:24:56 +0100 From: Richard Huxton User-Agent: Thunderbird 1.5 (X11/20051201) MIME-Version: 1.0 To: Tom Lane Cc: Brian Herlihy , pgsql-performance@postgresql.org Subject: Re: Spotting planner errors (was Re: Query planner is using References: <20060407064108.49532.qmail@web52315.mail.yahoo.com> <11739.1144420493@sss.pgh.pa.us> <4436805A.1040507@archonet.com> <12067.1144422772@sss.pgh.pa.us> In-Reply-To: <12067.1144422772@sss.pgh.pa.us> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200604/137 X-Sequence-Number: 18221 Tom Lane wrote: > Richard Huxton writes: >> Tom - does the planner/executor know it's got row estimates wrong? That >> is, if I'm not running an EXPLAIN ANALYSE is there a point at which we >> could log "planner estimate for X out by factor of Y"? > > Not at the moment, but you could certainly imagine changing the executor > to count rows even without EXPLAIN ANALYZE, and then complain during > plan shutdown. > > Not sure how helpful that would be; there would be a lot of noise from > common cases such as executing underneath a LIMIT node. Hmm - thinking about it you'd probably want to record it similarly to stats too. It's the fact that the planner *repeatedly* gets an estimate wrong that's of interest. Would it be prohibitive to total actions taken - to act as raw data for random_page_cost / cpu_xxx_cost? If you could get a ratio of estimated vs actual time vs the various page-fetches/index-fetches etc. we could actually plug some meaningful numbers in. -- Richard Huxton Archonet Ltd