From: Jim C. Nasby <decibel@decibel.org>
To: Simon Riggs <simon@2ndquadrant.com>
Cc: David Brown <time@bigpond.net.au>
Cc: pgsql-performance@postgresql.org
Subject: Re: Analyzer is clueless
Date: Wed, 17 Nov 2004 18:20:09 -0600
Message-ID: <20041118002008.GL80532@decibel.org> (raw)
In-Reply-To: <1100730768.4113.7709.camel@localhost.localdomain>
References: <20041117160824.B694D3A3ECC@svr1.postgresql.org>
<1100730768.4113.7709.camel@localhost.localdomain>
On Wed, Nov 17, 2004 at 10:32:48PM +0000, Simon Riggs wrote:
> The main issue is that PostgreSQL's default histogram statistics setting
> is lower than other RDBMS. This means that it is less able to
> discriminate between cases such as yours that are close to the edge.
> This is a trade-off between run-time of the ANALYZE command and the
> benefit it produces. As Joshua suggests, increasing the statistics
> target for this table will likely allow the optimizer to correctly
> determine the selectivity of the index and take the right path.
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?
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?
--
Jim C. Nasby, Database Consultant decibel@decibel.org
Give your computer some brain candy! www.distributed.net Team #1828
Windows: "Where do you want to go today?"
Linux: "Where do you want to go tomorrow?"
FreeBSD: "Are you guys coming, or what?"
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: decibel@decibel.org, simon@2ndquadrant.com, time@bigpond.net.au
Subject: Re: Analyzer is clueless
In-Reply-To: <20041118002008.GL80532@decibel.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox