pg_stat_reset() not resetting all statistics counters

From: Rafael Martinez <r(dot)m(dot)guerrero(at)usit(dot)uio(dot)no>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: pg_stat_reset() not resetting all statistics counters
Date: 2009-07-15 12:13:34
Message-ID: 4A5DC7EE.4060606@usit.uio.no
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

Should not the execution of pg_stat_reset() reset *all* statistics
counters everywhere in the database?

We would like to use the numbers in pg_stat_database together with
pg_postmaster_start_time() to find out the average values per second of
some of the columns in this view.

But when we execute pg_stat_reset() in our databases, not all values
reported by pg_stat_database get updated. tup_returned, tup_fetched,
tup_inserted, tup_updated and tup_deleted still have the old values
after running pg_stat_reset().

Am I missing anything?

Example: postgreSQL 8.3.7 running in a x86_64 GNU/Linux server.

Data from pg_stat_database for the database 'rtprod' *before* running
pg_stat_reset():

-[ RECORD 5 ]-+--------------
datid | 16777
datname | rtprod
numbackends | 40
xact_commit | 1800706565
xact_rollback | 98722
blks_read | 1384382954
blks_hit | 70569876640
tup_returned | 1742826466651
tup_fetched | 67404470469
tup_inserted | 54681321
tup_updated | 11495258
tup_deleted | 18167792

Data from pg_stat_database for the database 'rtprod' *after* running
pg_stat_reset():

-[ RECORD 5 ]-+--------------
datid | 16777
datname | rtprod
numbackends | 40
xact_commit | 10000
xact_rollback | 2
blks_read | 60
blks_hit | 264238
tup_returned | 1742832161264
tup_fetched | 67407042466
tup_inserted | 54681617
tup_updated | 11495340
tup_deleted | 18167979

Any ideas?

regards,
--
Rafael Martinez, <r(dot)m(dot)guerrero(at)usit(dot)uio(dot)no>
Center for Information Technology Services
University of Oslo, Norway

PGP Public Key: http://folk.uio.no/rafael/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Brad Nicholson 2009-07-15 12:25:12 Re: pg_stat_reset() not resetting all statistics counters
Previous Message Florian Chis 2009-07-15 08:36:34 change database