]> granicus.if.org Git - postgresql/commit
Fix VACUUM's reporting of dead-tuple counts to the stats collector.
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 19 Jan 2014 00:24:20 +0000 (19:24 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 19 Jan 2014 00:24:33 +0000 (19:24 -0500)
commit115f414124e71749d2d8f512e469ca63bc2166e5
treeab361085d44a3491bc034041470a2fab1c644e92
parent76e91b38ba64e1da70ea21744b342cb105ea3400
Fix VACUUM's reporting of dead-tuple counts to the stats collector.

Historically, VACUUM has just reported its new_rel_tuples estimate
(the same thing it puts into pg_class.reltuples) to the stats collector.
That number counts both live and dead-but-not-yet-reclaimable tuples.
This behavior may once have been right, but modern versions of the
pgstats code track live and dead tuple counts separately, so putting
the total into n_live_tuples and zero into n_dead_tuples is surely
pretty bogus.  Fix it to report live and dead tuple counts separately.

This doesn't really do much for situations where updating transactions
commit concurrently with a VACUUM scan (possibly causing double-counting or
omission of the tuples they add or delete); but it's clearly an improvement
over what we were doing before.

Hari Babu, reviewed by Amit Kapila
src/backend/commands/vacuumlazy.c
src/backend/postmaster/pgstat.c
src/include/pgstat.h