-
- Downloads
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.
Showing
- doc/src/sgml/monitoring.sgml 16 additions, 4 deletionsdoc/src/sgml/monitoring.sgml
- src/backend/access/transam/xact.c 4 additions, 1 deletionsrc/backend/access/transam/xact.c
- src/backend/postmaster/pgstat.c 87 additions, 63 deletionssrc/backend/postmaster/pgstat.c
- src/backend/utils/adt/pgstatfuncs.c 24 additions, 12 deletionssrc/backend/utils/adt/pgstatfuncs.c
- src/include/catalog/catversion.h 2 additions, 2 deletionssrc/include/catalog/catversion.h
- src/include/catalog/pg_proc.h 5 additions, 3 deletionssrc/include/catalog/pg_proc.h
- src/include/pgstat.h 2 additions, 1 deletionsrc/include/pgstat.h
- src/test/regress/expected/stats.out 28 additions, 44 deletionssrc/test/regress/expected/stats.out
- src/test/regress/sql/stats.sql 20 additions, 36 deletionssrc/test/regress/sql/stats.sql
Loading
Please register or sign in to comment