Skip site navigation (1) Skip section navigation (2)

not all pg_stat_database fields reset after pg_stat_reset()

From: tv(at)fuzzy(dot)cz
To: pgsql-bugs(at)postgresql(dot)org
Subject: not all pg_stat_database fields reset after pg_stat_reset()
Date: 2010-12-11 16:19:11
Message-ID: 4e19b0bfc836f7002752517e7792a0b9.squirrel@sq.gransy.com (view raw or flat)
Thread:
Lists: pgsql-bugs
After calling pg_stat_reset, some of the database stats fields are not
actually reset, the value is preserved. I've found the bug is actually in
pgstat_recv_resetcounter function, where only some of the
PgStat_StatDBEntry fields are reset to 0.

This is true for those 6 fields:

n_tuples_returned
n_tuples_fetched
n_tuples_inserted
n_tuples_updated
n_tuples_deleted
last_autovac_time

The docs for "pg_stat_reset()" say "Reset all statistics counters for the
current database to zero (requiret superuser privileges)" and I don't see
any reason why these fields should not be reset, so I guess it's a bug.

See the patch attached (against current dev version).

regards
Tomas

Attachment: missing-fields.diff
Description: text/plain (649 bytes)

Responses

pgsql-bugs by date

Next:From: Tom LaneDate: 2010-12-11 17:31:31
Subject: Re: not all pg_stat_database fields reset after pg_stat_reset()
Previous:From: Tom LaneDate: 2010-12-11 15:44:33
Subject: Re: BUG #5788: I can drop table , with other user's table

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group