Re: Expected accuracy of planner statistics - Mailing list pgsql-general

From Jim C. Nasby
Subject Re: Expected accuracy of planner statistics
Date
Msg-id 20060929010011.GQ34238@nasby.net
Whole thread Raw
In response to Expected accuracy of planner statistics  (Casey Duncan <casey@pandora.com>)
List pgsql-general
On Thu, Sep 28, 2006 at 03:19:46PM -0700, Casey Duncan wrote:
> I have some databases that have grown significantly over time (as
> databases do). As the databases have grown, I have noticed that the
> statistics have grown less and less accurate. In particular, the
> n_distinct values have become many OOM too small for certain foreign
> key columns. Predictably this leads to poor query plans.

Search the -hackers archives. The problem is that you can't actually get
a good n_distinct estimate if you're sampling less than a very large
chunk of the table. Since our sampling maxes out at something like 30k
pages, at some point the n_distinct estimates just degrade. :(

Patches/solutions welcome. :)
--
Jim Nasby                                            jim@nasby.net
EnterpriseDB      http://enterprisedb.com      512.569.9461 (cell)

pgsql-general by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: Can i see server SQL commands ?
Next
From: "Adnan DURSUN"
Date:
Subject: Re: Can i see server SQL commands ?