Re: Clearing global statistics

Greg Smith <greg@2ndquadrant.com>

From: Greg Smith <greg@2ndquadrant.com>
To: Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>
Cc: pgsql-hackers@postgresql.org
Date: 2009-12-07T00:50:11Z
Lists: pgsql-hackers
Itagaki Takahiro wrote:
> Greg Smith <greg@2ndquadrant.com> wrote:
>
>   
>> -Not sure if this should be named pg_stat_rest_global (to match the way 
>> these are called "global stats" in the source) or 
>> pg_stat_reset_cluster.  Picked the former for V1, not attached to that 
>> decision at all.  Might even make sense to use a name that makes it 
>> obvious the pg_stat_bgwriter data is what's targeted.
>>     
>
> A couple of comments:
>
>  * We will be able to reset global counters and current database's counters.
>    Do we need to have a method to reset other databases' counters?
>    Or, will pg_stat_reset_global just reset counters of all databases?
>
>  * Is it useful to have a method to reset counters separately?
>    For example, pg_stat_reset( which text )
>        which := 'buffers' | 'checkpoints' | 'tables' | 'functions' |  ...
>   
The fact that you're asking the question this way suggests to me I've 
named this completely wrong.  pg_stat_reset_global only resets the bits 
global to all databases.  It doesn't touch any of the database-specific 
things that pg_stat_reset can handle right now.  At the moment, the only 
global information is what's in pg_stat_bgwriter:  buffer statistics and 
checkpoint stats.  I'm thinking that I should rename this new function 
to pg_stat_reset_bgwriter so it's obvious how limited its target is.  
Using either "global" or "cluster" for the name is just going to leave 
people thinking it acts across a much larger area than it does.

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