Thread: Stats Collector

Stats Collector

From
"Christopher Kings-Lynne"
Date:
Is there any way of resetting the stats collector without restarting
Postgres?  I want all the pg_stat_* tables to have zero for everything
again...

Chris


Re: Stats Collector

From
Jan Wieck
Date:
Christopher Kings-Lynne wrote:
>
> Is there any way of resetting the stats collector without restarting
> Postgres?  I want all the pg_stat_* tables to have zero for everything
> again...

Hmmm,

there is a special control message for the collector to do so, and a
function that sends it exists too. But there is absolutely no way to
call it =:-O

Looks to me, someone forgot something. That would be me and now I
remember that I originally wanted to add some utility command for that.

What you need in the meantime is a little C function that calls

void pgstat_reset_counters(void);

I might find the time tomorrow to write one for you if you don't know
how.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #

Re: Stats Collector

From
Robert Treat
Date:
I don't think there is any way to do it without restarting the server
and using STATS_RESET_ON_SERVER_START from the postgresql.conf

you might be able to do it by killing the stats collector process on
your machine, but i cant recall if postmaster will automagically fire up
a new collector or if you have to do something more involved. It might
be worth trying on a development machine.

Robert Treat


On Mon, 2002-07-22 at 22:43, Christopher Kings-Lynne wrote:
> Is there any way of resetting the stats collector without restarting
> Postgres?  I want all the pg_stat_* tables to have zero for everything
> again...
>
> Chris
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org




Re: Stats Collector

From
Jan Wieck
Date:
Robert Treat wrote:
>
> I don't think there is any way to do it without restarting the server
> and using STATS_RESET_ON_SERVER_START from the postgresql.conf
>
> you might be able to do it by killing the stats collector process on
> your machine, but i cant recall if postmaster will automagically fire up
> a new collector or if you have to do something more involved. It might
> be worth trying on a development machine.

You can kill it and postmaster will fire up a new one, which ironically
reads in the data/global/pgstat.stat file if it exists, which on a busy
server get's recreated/overwritten every 500 milliseconds. You must
remove that file and kill the collector before it get's recreated ... so
semicolon is your friend ;-)


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #