Fix up pgstats counting of live and dead tuples to recognize that committed
Tom Lane <tgl@sss.pgh.pa.us>
Fix up pgstats counting of live and dead tuples to recognize that committed and aborted transactions have different effects; also teach it not to assume that prepared transactions are always committed. Along the way, simplify the pgstats API by tying counting directly to Relations; I cannot detect any redeeming social value in having stats pointers in HeapScanDesc and IndexScanDesc structures. And fix a few corner cases in which counts might be missed because the relation's pgstat_info pointer hadn't been set.
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/gin/ginscan.c | modified | +2 −2 |
| src/backend/access/gist/gistget.c | modified | +2 −2 |
| src/backend/access/hash/hashsearch.c | modified | +2 −2 |
| src/backend/access/heap/heapam.c | modified | +22 −18 |
| src/backend/access/index/genam.c | modified | +1 −3 |
| src/backend/access/index/indexam.c | modified | +5 −7 |
| src/backend/access/nbtree/nbtsearch.c | modified | +2 −2 |
| src/backend/access/transam/twophase.c | modified | +3 −2 |
| src/backend/access/transam/twophase_rmgr.c | modified | +8 −4 |
| src/backend/access/transam/xact.c | modified | +9 −6 |
| src/backend/executor/nodeBitmapHeapscan.c | modified | +4 −4 |
| src/backend/postmaster/bgwriter.c | modified | +1 −13 |
| src/backend/postmaster/pgstat.c | modified | +595 −241 |
| src/backend/storage/buffer/bufmgr.c | modified | +3 −9 |
| src/backend/utils/cache/relcache.c | modified | +3 −1 |
| src/include/access/heapam.h | modified | +3 −3 |
| src/include/access/relscan.h | modified | +1 −5 |
| src/include/access/twophase_rmgr.h | modified | +3 −2 |
| src/include/pgstat.h | modified | +130 −76 |
| src/include/utils/rel.h | modified | +3 −12 |