summaryrefslogtreecommitdiff
path: root/doc/src/sgml
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-02-07 23:11:30 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-02-07 23:11:30 +0000
commitaec4cf1c8c410f9c9db3deabcb94502dcd355b3f (patch)
tree18ff3f246c08608d5b09f3da0d267a51f3318378 /doc/src/sgml
parentd9ce68872f7f6aab6cea2481b991b3c1a83d1956 (diff)
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.
Diffstat (limited to 'doc/src/sgml')
-rw-r--r--doc/src/sgml/monitoring.sgml20
1 files changed, 16 insertions, 4 deletions
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 @@
-<!-- $PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.45 2007/02/01 00:28:17 momjian Exp $ -->
+<!-- $PostgreSQL: pgsql/doc/src/sgml/monitoring.sgml,v 1.46 2007/02/07 23:11:29 tgl Exp $ -->
<chapter id="monitoring">
<title>Monitoring Database Activity</title>
@@ -227,7 +227,10 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
queries on the statistics and correlate the results without worrying that
the numbers are changing underneath you. But if you want to see new
results with each query, be sure to do the queries outside any transaction
- block.
+ block. Alternatively, you can invoke
+ <function>pg_stat_clear_snapshot</function>(), 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.
</para>
<table id="monitoring-stats-views-table">
@@ -708,10 +711,19 @@ postgres: <replaceable>user</> <replaceable>database</> <replaceable>host</> <re
</row>
<row>
+ <entry><literal><function>pg_stat_clear_snapshot</function>()</literal></entry>
+ <entry><type>void</type></entry>
+ <entry>
+ Discard the current statistics snapshot
+ </entry>
+ </row>
+
+ <row>
<entry><literal><function>pg_stat_reset</function>()</literal></entry>
- <entry><type>boolean</type></entry>
+ <entry><type>void</type></entry>
<entry>
- Reset all block-level and row-level statistics to zero
+ Reset all statistics counters for the current database to zero
+ (requires superuser privileges)
</entry>
</row>
</tbody>