Re: Where does data in pg_stat_user_tables come from?

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: Where does data in pg_stat_user_tables come from?
Дата
Msg-id 4C8EB813.6070204@agliodbs.com
обсуждение исходный текст
Ответ на Re: Where does data in pg_stat_user_tables come from?  ("Joshua D. Drake" <jd@commandprompt.com>)
Ответы Re: Where does data in pg_stat_user_tables come from?  ("Joshua D. Drake" <jd@commandprompt.com>)
Re: Where does data in pg_stat_user_tables come from?  ("Joshua D. Drake" <jd@commandprompt.com>)
Список pgsql-performance
On 9/13/10 4:41 PM, Joshua D. Drake wrote:
> On Mon, 2010-09-13 at 16:06 -0700, Josh Berkus wrote:
>> All,
>>
>> I've been looking at pg_stat_user_tables (in 8.3, because of a project I
>> have), and it appears that autovacuum, and only autovaccum, updates the
>> data for this view.  This means that one can never have data in
>> pg_stat_user_tables which is completely up-to-date, and if autovacuum is
>> off, the view is useless.
>
> As I recall its kept in shared_buffers (in some kind of counter) and
> updated only when it is requested or when autovacuum fires. This was
> done because we used to write stats every 500ms and it was a bottleneck.
> (IIRC)

Yes, looks like it only gets updated on SELECT or on autovacuum.

Thing is, a full VACUUM ANALYZE on the database, or even just ANALYZE,
should update some of the counters.  And currently it doesnt, resulting
in pg_class.reltuples often being far more up to date than
pg_stat_user_tables.n_live_tup.  And frankly, no way to reconcile those
two stats.

--
                                  -- Josh Berkus
                                     PostgreSQL Experts Inc.
                                     http://www.pgexperts.com

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

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Where does data in pg_stat_user_tables come from?
Следующее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Where does data in pg_stat_user_tables come from?