Re: Clearing global statistics

Поиск
Список
Период
Сортировка
От Greg Smith
Тема Re: Clearing global statistics
Дата
Msg-id 4B4F5A4C.5000802@2ndquadrant.com
обсуждение исходный текст
Ответ на Re: Clearing global statistics  (Rafael Martinez <r.m.guerrero@usit.uio.no>)
Ответы Re: Clearing global statistics  (Rafael Martinez <r.m.guerrero@usit.uio.no>)
Список pgsql-hackers
Rafael Martinez wrote:
> One thing I miss from the statistics you can get via pg_stat_* is
> information about how long we have been collecting stats (or in other
> words, when was the last time the stats were reset)
>   

I've considered adding this for the same reasons you're asking about it, 
but am not happy with the trade-offs involved.  The problem is that you 
have to presume the server was running the entirety of the time since 
stats were reset for that data to be useful.  So unless people are in 
that situation, they're going to get data that may not represent what 
they think it does.  Realistically, if you want a timestamp that always 
means something useful you have to rest the stats at every server start, 
which leads us to:

> Before 8.3, we had the stats_reset_on_server_start parameter and the
> pg_postmaster_start_time() function. This was an easy way of resetting
> *all* statistics delivered by pg_stat_* and knowing when this was done.
> We were able to produce stats with information about sec/hours/days
> average values in an easy way.
>   

With this new feature I'm submitting, you can adjust your database 
startup scripts to make this happen again.  Start the server, 
immediately loop over every database and call pg_stat_reset on them all, 
and call pg_stat_reset_shared('bgwriter').  Now you've got completely 
cleared stats that are within a second or two of 
pg_postmaster_start_time(), should be close enough to most purposes.  
Theoretically we could automate that better, but I've found it hard to 
justify working on given that it's not that difficult to handle outside 
of the database once the individual pieces are exposed.

-- 
Greg Smith    2ndQuadrant   Baltimore, MD
PostgreSQL Training, Services and Support
greg@2ndQuadrant.com  www.2ndQuadrant.com



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

Предыдущее
От: Tim Bunce
Дата:
Сообщение: Re: Miscellaneous changes to plperl [PATCH]
Следующее
От: Fujii Masao
Дата:
Сообщение: Re: archive_timeout behavior for no activity