Resetting cluster-wide statistics

Lists: pgsql-hackers
From: Greg Smith <gsmith(at)gregsmith(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Resetting cluster-wide statistics
Date: 2009-03-23 23:15:35
Message-ID: alpine.GSO.2.01.0903231904500.15203@westnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

There are a few statistics that are only kept on a per-cluster basis, such
as those reported in pg_stat_database and pg_stat_bgwriter. Since
pg_stat_reset only resets per-database counts, it doesn't touch those.

I'd like to have a function that resets those. Maybe iterates over all
the databases while it's at it and clear the whole mess out as another
option. I'm curious why something resetting the cluster-wide stats isn't
available already. Just because nobody bothered to write it before, or is
there some reason why this can't work that I just didn't notice during my
brief scan of pgstat.c?

--
* Greg Smith gsmith(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Smith <gsmith(at)gregsmith(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Resetting cluster-wide statistics
Date: 2009-03-24 00:52:58
Message-ID: 5952.1237855978@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Greg Smith <gsmith(at)gregsmith(dot)com> writes:
> I'm curious why something resetting the cluster-wide stats isn't
> available already.

We used to have the stats_reset_on_server_start thingy, which covered
that case. When we removed it on the grounds that you could do the
same less klugily with pg_stat_reset(), nobody complained about
cluster-wide stats...

regards, tom lane


From: Greg Smith <gsmith(at)gregsmith(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Resetting cluster-wide statistics
Date: 2009-03-24 04:18:54
Message-ID: alpine.GSO.2.01.0903240012280.29721@westnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Mon, 23 Mar 2009, Tom Lane wrote:

> We used to have the stats_reset_on_server_start thingy, which covered
> that case. When we removed it on the grounds that you could do the
> same less klugily with pg_stat_reset(), nobody complained about
> cluster-wide stats...

Not exactly sure of the sequence here, but I think that was before
pg_stat_bgwriter was introduced. That was late in the 8.3 cycle and one
of the primary things I'd like have a good way to reset. I'll dig back to
the commit that wiped out stats_reset_on_server_stat and see what it used
to do. I might suggest something that puts something similar back,
perhaps with a more targeted UI given that pg_stat_reset has taken over
its original primary function.

--
* Greg Smith gsmith(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Greg Smith <gsmith(at)gregsmith(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Resetting cluster-wide statistics
Date: 2009-04-09 16:29:19
Message-ID: 200904091629.n39GTJk10103@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Greg Smith wrote:
> On Mon, 23 Mar 2009, Tom Lane wrote:
>
> > We used to have the stats_reset_on_server_start thingy, which covered
> > that case. When we removed it on the grounds that you could do the
> > same less klugily with pg_stat_reset(), nobody complained about
> > cluster-wide stats...
>
> Not exactly sure of the sequence here, but I think that was before
> pg_stat_bgwriter was introduced. That was late in the 8.3 cycle and one
> of the primary things I'd like have a good way to reset. I'll dig back to
> the commit that wiped out stats_reset_on_server_stat and see what it used
> to do. I might suggest something that puts something similar back,
> perhaps with a more targeted UI given that pg_stat_reset has taken over
> its original primary function.

Added to TODO:

Allow the clearing of cluster-level statistics

* http://archives.postgresql.org/pgsql-hackers/2009-03/msg00917.php

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +