@@ -765,9 +765,9 @@ lazy_scan_heap(Relation onerel, VacuumParams *params, LVRelStats *vacrelstats,
765765next_fsm_block_to_vacuum ;
766766double num_tuples ,/* total number of nonremovable tuples */
767767live_tuples ,/* live tuples (reltuples estimate) */
768- tups_vacuumed ,/* tuples cleaned up by vacuum */
768+ tups_vacuumed ,/* tuples cleaned up bycurrent vacuum */
769769nkeep ,/* dead-but-not-removable tuples */
770- nunused ;/* unused line pointers */
770+ nunused ;/*# existing unused line pointers */
771771IndexBulkDeleteResult * * indstats ;
772772int i ;
773773PGRUsage ru0 ;
@@ -1234,7 +1234,8 @@ lazy_scan_heap(Relation onerel, VacuumParams *params, LVRelStats *vacrelstats,
12341234/*
12351235 * Prune all HOT-update chains in this page.
12361236 *
1237- * We count tuples removed by the pruning step as removed by VACUUM.
1237+ * We count tuples removed by the pruning step as removed by VACUUM
1238+ * (existing LP_DEAD line pointers don't count).
12381239 */
12391240tups_vacuumed += heap_page_prune (onerel ,buf ,vistest , false,
12401241InvalidTransactionId ,0 ,
@@ -1286,10 +1287,13 @@ lazy_scan_heap(Relation onerel, VacuumParams *params, LVRelStats *vacrelstats,
12861287ItemPointerSet (& (tuple .t_self ),blkno ,offnum );
12871288
12881289/*
1289- *DEAD line pointers are to be vacuumed normally; but we don't
1290+ *LP_DEAD line pointers are to be vacuumed normally; but we don't
12901291 * count them in tups_vacuumed, else we'd be double-counting (at
12911292 * least in the common case where heap_page_prune() just freed up
1292- * a non-HOT tuple).
1293+ * a non-HOT tuple). Note also that the final tups_vacuumed value
1294+ * might be very low for tables where opportunistic page pruning
1295+ * happens to occur very frequently (via heap_page_prune_opt()
1296+ * calls that free up non-HOT tuples).
12931297 */
12941298if (ItemIdIsDead (itemid ))
12951299{
@@ -1742,10 +1746,6 @@ lazy_scan_heap(Relation onerel, VacuumParams *params, LVRelStats *vacrelstats,
17421746vacrelstats -> relname ,
17431747tups_vacuumed ,vacuumed_pages )));
17441748
1745- /*
1746- * This is pretty messy, but we split it up so that we can skip emitting
1747- * individual parts of the message when not applicable.
1748- */
17491749initStringInfo (& buf );
17501750appendStringInfo (& buf ,
17511751_ ("%.0f dead row versions cannot be removed yet, oldest xmin: %u\n" ),