From aec4cf1c8c410f9c9db3deabcb94502dcd355b3f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 7 Feb 2007 23:11:30 +0000 Subject: Add a function pg_stat_clear_snapshot() that discards any statistics snapshot already collected in the current transaction; this allows plpgsql functions to watch for stats updates even though they are confined to a single transaction. Use this instead of the previous kluge involving pg_stat_file() to wait for the stats collector to update in the stats regression test. Internally, decouple storage of stats snapshots from transaction boundaries; they'll now stick around until someone calls pgstat_clear_snapshot --- which xact.c still does at transaction end, to maintain the previous behavior. This makes the logic a lot cleaner, at the price of a couple dozen cycles per transaction exit. --- doc/src/sgml/monitoring.sgml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 54adf3990b1..4a9732fc39a 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -1,4 +1,4 @@ - + Monitoring Database Activity @@ -227,7 +227,10 @@ postgres: user database host pg_stat_clear_snapshot(), which will discard the + current transaction's statistics snapshot (if any). The next use of + statistical information will cause a new snapshot to be fetched. @@ -707,11 +710,20 @@ postgres: user database host + + pg_stat_clear_snapshot() + void + + Discard the current statistics snapshot + + + pg_stat_reset() - boolean + void - Reset all block-level and row-level statistics to zero + Reset all statistics counters for the current database to zero + (requires superuser privileges) -- cgit v1.2.3