Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id F05251337BA8 for ; Tue, 19 Apr 2011 22:50:58 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 62844-04 for ; Wed, 20 Apr 2011 01:50:41 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp-1.01.com (smtp-1.01.com [38.102.63.180]) by mail.postgresql.org (Postfix) with ESMTP id 331321337BB4 for ; Tue, 19 Apr 2011 22:50:41 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp-1.01.com (Postfix) with ESMTP id 8E594366157; Tue, 19 Apr 2011 20:50:41 -0500 (CDT) Received: from smtp-1.01.com ([127.0.0.1]) by localhost (smtp-1.01.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pDxfVhBZ0a2Q; Tue, 19 Apr 2011 20:50:41 -0500 (CDT) Received: by smtp-1.01.com (Postfix, from userid 99) id 68F8E366156; Tue, 19 Apr 2011 20:50:41 -0500 (CDT) Received: from Sidney-Stratton.local (70-36-143-243.dsl.dynamic.sonic.net [70.36.143.243]) by smtp-1.01.com (Postfix) with ESMTPSA id EB8CE366157; Tue, 19 Apr 2011 20:50:40 -0500 (CDT) Message-ID: <4DAE3BF0.2060806@agliodbs.com> Date: Tue, 19 Apr 2011 18:50:40 -0700 From: Josh Berkus Organization: PostgreSQL Experts Inc. User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9 MIME-Version: 1.0 To: Robert Haas CC: Tom Lane , 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> <4D8A8AB8.7040401@agliodbs.com> <3210.1301063084@sss.pgh.pa.us> In-Reply-To: X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: 201104/276 X-Sequence-Number: 43338 On 4/19/11 7:29 AM, Robert Haas wrote: > Another thought is that we might want to consider reducing > autovacuum_analyze_scale_factor. The root of the original problem > seems to be that the table had some data churn but not enough to cause > an ANALYZE. Now, if the data churn is random, auto-analyzing after > 10% churn might be reasonable, but a lot of data churn is non-random, > and ANALYZE is fairly cheap. I wouldn't reduce the defaults for PostgreSQL; this is something you do on specific tables. For example, on very large tables I've been known to set analyze_scale_factor to 0 and analyze_threshold to 5000. And don't assume that analyzing is always cheap. If you have an 800GB table, most of which is very cold data, and have statistics set to 5000 for some columns, accessing many of the older blocks could take a while. -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com