@@ -765,9 +765,9 @@ lazy_scan_heap(Relation onerel, VacuumParams *params, LVRelStats *vacrelstats,
765765 next_fsm_block_to_vacuum ;
766766 double num_tuples , /* total number of nonremovable tuples */
767767 live_tuples , /* live tuples (reltuples estimate) */
768- tups_vacuumed , /* tuples cleaned up by vacuum */
768+ tups_vacuumed , /* tuples cleaned up by current vacuum */
769769 nkeep , /* dead-but-not-removable tuples */
770- nunused ; /* unused line pointers */
770+ nunused ; /* # existing unused line pointers */
771771 IndexBulkDeleteResult * * indstats ;
772772 int i ;
773773 PGRUsage 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 */
12391240 tups_vacuumed += heap_page_prune (onerel , buf , vistest , false,
12401241 InvalidTransactionId , 0 ,
@@ -1286,10 +1287,13 @@ lazy_scan_heap(Relation onerel, VacuumParams *params, LVRelStats *vacrelstats,
12861287 ItemPointerSet (& (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 */
12941298 if (ItemIdIsDead (itemid ))
12951299 {
@@ -1742,10 +1746,6 @@ lazy_scan_heap(Relation onerel, VacuumParams *params, LVRelStats *vacrelstats,
17421746 vacrelstats -> relname ,
17431747 tups_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- */
17491749 initStringInfo (& buf );
17501750 appendStringInfo (& buf ,
17511751 _ ("%.0f dead row versions cannot be removed yet, oldest xmin: %u\n" ),
0 commit comments