Re: Expected accuracy of planner statistics

From: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>
To: Casey Duncan <casey(at)pandora(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Expected accuracy of planner statistics
Date: 2006-09-29 01:00:11
Message-ID: 20060929010011.GQ34238@nasby.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)nasby(dot)net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adnan DURSUN 2006-09-29 02:17:30 Re: Can i see server SQL commands ?
Previous Message Jim C. Nasby 2006-09-29 00:56:25 Re: Can i see server SQL commands ?