Thread: pgsql: Fix multi-table VACUUM VERBOSE accounting.

pgsql: Fix multi-table VACUUM VERBOSE accounting.

From
Peter Geoghegan
Date:
Fix multi-table VACUUM VERBOSE accounting.

Per-backend global variables like VacuumPageHit are initialized once per
VACUUM command.  This was missed by commit 49c9d9fc, which unified
VACUUM VERBOSE and autovacuum logging.  As a result of that oversight,
incorrect values were shown when multiple relations were processed by a
single VACUUM VERBOSE command.

Relations that happened to be processed later on would show "buffer
usage:" values that incorrectly included buffer accesses made while
processing earlier unrelated relations.  The same accesses were counted
multiple times.

To fix, take initial values for the tracker variables at the start of
heap_vacuum_rel(), and report delta values later on.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d3609dd2547b3ed807bc3b6dd27a008d65e86668

Modified Files
--------------
src/backend/access/heap/vacuumlazy.c | 24 +++++++++++++++---------
1 file changed, 15 insertions(+), 9 deletions(-)