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)