]> granicus.if.org Git - postgresql/commit
Add a function pg_stat_clear_snapshot() that discards any statistics snapshot
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 7 Feb 2007 23:11:30 +0000 (23:11 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 7 Feb 2007 23:11:30 +0000 (23:11 +0000)
commitaec4cf1c8c410f9c9db3deabcb94502dcd355b3f
tree18ff3f246c08608d5b09f3da0d267a51f3318378
parentd9ce68872f7f6aab6cea2481b991b3c1a83d1956
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
src/backend/access/transam/xact.c
src/backend/postmaster/pgstat.c
src/backend/utils/adt/pgstatfuncs.c
src/include/catalog/catversion.h
src/include/catalog/pg_proc.h
src/include/pgstat.h
src/test/regress/expected/stats.out
src/test/regress/sql/stats.sql