X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3665E3A4489 for ; Thu, 18 Nov 2004 01:38:39 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 91936-06 for ; Thu, 18 Nov 2004 01:38:33 +0000 (GMT) Received: from davinci.ethosmedia.com (server226.ethosmedia.com [209.128.84.226]) by svr1.postgresql.org (Postfix) with ESMTP id 2050E3A450F for ; Thu, 18 Nov 2004 01:38:36 +0000 (GMT) Received: from [64.81.245.111] (account josh@agliodbs.com HELO temoku.sf.agliodbs.com) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.1.8) with ESMTP id 6676327; Wed, 17 Nov 2004 17:40:06 -0800 From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: pgsql-performance@postgresql.org Subject: Re: Analyzer is clueless Date: Wed, 17 Nov 2004 17:41:16 -0800 User-Agent: KMail/1.6.2 Cc: "Jim C. Nasby" , Simon Riggs , David Brown References: <20041117160824.B694D3A3ECC@svr1.postgresql.org> <1100730768.4113.7709.camel@localhost.localdomain> <20041118002008.GL80532@decibel.org> In-Reply-To: <20041118002008.GL80532@decibel.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200411171741.16515.josh@agliodbs.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/273 X-Sequence-Number: 9227 Jim, > Is there still a good reason to have the histogram stats so low? Should > the default be changed to more like 100 at this point? Low overhead. This is actually a TODO for me for 8.1. I need to find some test cases to set a differential level of histogram access for indexed fields, so like 10 for most fields but 100/150/200 for indexed fields. However, I got stalled on finding test cases and then ran out of time. > Also, how extensively does the planner use n_distinct, null_frac, > reltuples and the histogram to see what the odds are of finding a unique > value or a low number of values? I've seen cases where it seems the > planer doesn't think it'll be getting a unique value or a small set of > values even though stats indicates that it should be. > > One final question... would there be interest in a process that would > dynamically update the histogram settings for tables based on how > distinct/unique each field was? Well, the process by which the analyzer decides that a field is unique could probably use some troubleshooting. And we always, always could use suggestions/tests/help with the query planner. -- --Josh Josh Berkus Aglio Database Solutions San Francisco