Have TRUNCATE update pgstat tuple counters
This works by keeping a per-subtransaction record of the ins/upd/del counters before the truncate, and then resetting them; this record is useful to return to the previous state in case the truncate is rolled back, either in a subtransaction or whole transaction. The state is propagated upwards as subtransactions commit. When the per-table data is sent to the stats collector, a flag indicates to reset the live/dead counters to zero as well. Catalog version bumped due to the change in pgstat format. Author: Alexander Shulgin Discussion: 1007.1207238291@sss.pgh.pa.us Discussion: 548F7D38.2000401@BlueTreble.com Reviewed-by: Álvaro Herrera, Jim Nasby
Showing
- src/backend/commands/tablecmds.c 3 additions, 0 deletionssrc/backend/commands/tablecmds.c
- src/backend/postmaster/pgstat.c 107 additions, 3 deletionssrc/backend/postmaster/pgstat.c
- src/include/pgstat.h 6 additions, 0 deletionssrc/include/pgstat.h
- src/test/regress/expected/prepared_xacts.out 50 additions, 0 deletionssrc/test/regress/expected/prepared_xacts.out
- src/test/regress/expected/prepared_xacts_1.out 53 additions, 0 deletionssrc/test/regress/expected/prepared_xacts_1.out
- src/test/regress/expected/stats.out 64 additions, 0 deletionssrc/test/regress/expected/stats.out
- src/test/regress/sql/prepared_xacts.sql 27 additions, 0 deletionssrc/test/regress/sql/prepared_xacts.sql
- src/test/regress/sql/stats.sql 64 additions, 0 deletionssrc/test/regress/sql/stats.sql
Loading
Please register or sign in to comment