Thread: pgsql: Add a function pg_stat_clear_snapshot() that discards any
pgsql: Add a function pg_stat_clear_snapshot() that discards any
From
tgl@postgresql.org (Tom Lane)
Date:
Log Message: ----------- 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. Modified Files: -------------- pgsql/doc/src/sgml: monitoring.sgml (r1.45 -> r1.46) (http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/monitoring.sgml.diff?r1=1.45&r2=1.46) pgsql/src/backend/access/transam: xact.c (r1.232 -> r1.233) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/transam/xact.c.diff?r1=1.232&r2=1.233) pgsql/src/backend/postmaster: pgstat.c (r1.144 -> r1.145) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/postmaster/pgstat.c.diff?r1=1.144&r2=1.145) pgsql/src/backend/utils/adt: pgstatfuncs.c (r1.37 -> r1.38) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/pgstatfuncs.c.diff?r1=1.37&r2=1.38) pgsql/src/include/catalog: catversion.h (r1.381 -> r1.382) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/catversion.h.diff?r1=1.381&r2=1.382) pg_proc.h (r1.442 -> r1.443) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/catalog/pg_proc.h.diff?r1=1.442&r2=1.443) pgsql/src/include: pgstat.h (r1.52 -> r1.53) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/pgstat.h.diff?r1=1.52&r2=1.53) pgsql/src/test/regress/expected: stats.out (r1.9 -> r1.10) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/expected/stats.out.diff?r1=1.9&r2=1.10) pgsql/src/test/regress/sql: stats.sql (r1.7 -> r1.8) (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/test/regress/sql/stats.sql.diff?r1=1.7&r2=1.8)