Re: Clearing global statistics - Mailing list pgsql-hackers

From Greg Smith
Subject Re: Clearing global statistics
Date
Msg-id 4B4F6697.8040808@2ndquadrant.com
Whole thread Raw
In response to Re: Clearing global statistics  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Seems like a more appropriate solution would be to make it easier to do
> that subtraction, ie, make it easier to capture the values at a given
> time point and then get deltas from there.  It's more general (you could
> have multiple saved sets of values), and doesn't require superuser
> permissions to do, and doesn't have the same potential for
> damn-I-wish-I-hadn't-done-that moments.
>   

You can make the same argument about the existing pg_stat_reset 
mechanism.  I would love to completely rework the stats infrastructure 
so that it's easier to capture values with timestamps, compute diffs, 
and do trending.  However, I'm not sure the database itself is 
necessarily the best place to do that at anyway.  People who know what 
they're doing are already handling this exact job using external tools 
that grab regular snapshots for that purpose, so why try to duplicate 
that work?

I'm trying to triage here, to scrub off the worst of the common 
problems.  I would never claim this is the perfect direction to follow 
forever.  There are a number of people who consider the inability to 
reset the pg_stat_bgwriter stats in any way a bug that's gone unfixed 
for two versions now.  Your larger point that this style of 
implementation is not ideal as a long-term way to manage statistics I 
would completely agree with, I just don't have the time to spend on a 
major rewrite to improve that.  What I can offer is a fix for the most 
common issue I get complaints about, in the form of a tool much more 
likely to be used correctly by people who go looking for it than misused 
IMHO.

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



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: EXPLAIN, utility statement parameters, and recent plpgsql changes
Next
From: David Fetter
Date:
Subject: Re: Miscellaneous changes to plperl [PATCH]