Re: Wrong stats for empty tables

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Wrong stats for empty tables
Дата
Msg-id 13505.1241562432@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Wrong stats for empty tables  (Josh Berkus <josh@agliodbs.com>)
Список pgsql-hackers
Josh Berkus <josh@agliodbs.com> writes:
> On 5/5/09 9:52 AM, Tom Lane wrote:
>> No, it's intentional.

> Huh?  Why would we want wrong stats?

Tables rarely stay empty; and a plan generated on the assumption that a
table is empty is likely to suck much more when the table stops being
empty than a plan generated on the assumption that the table contains
some data will suck when it really doesn't.  Neither case is really
attractive, but the downside of a size underestimate tends to be a
lot worse than that of an overestimate.

This decision was made before we had autovacuum/autoanalyze support
or the ability to replan automatically after a stats update, but I think
it's still good even now that we do.  You can add a hundred or so tuples
to an empty table before autovac will deign to pay attention, and that's
more than enough to blow a nestloop plan out of the water.  Also, the
most common case for this type of issue is a temp table, which autovac
can't help with at all.
        regards, tom lane


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: "could not reattach to shared memory" captured in buildfarm
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: bytea vs. pg_dump