* send its own new total to pgstats, and we don't want this delta applied
* on top of that.)
*
+ * Sets latestRemovedXid for caller on return.
+ *
* off_loc is the offset location required by the caller to use in error
* callback.
*
- * Returns the number of tuples deleted from the page and sets
- * latestRemovedXid.
+ * Returns the number of tuples deleted from the page during this call.
*/
int
heap_page_prune(Relation relation, Buffer buffer,
next_fsm_block_to_vacuum;
double num_tuples, /* total number of nonremovable tuples */
live_tuples, /* live tuples (reltuples estimate) */
- tups_vacuumed, /* tuples cleaned up by vacuum */
+ tups_vacuumed, /* tuples cleaned up by current vacuum */
nkeep, /* dead-but-not-removable tuples */
- nunused; /* unused line pointers */
+ nunused; /* # existing unused line pointers */
IndexBulkDeleteResult **indstats;
int i;
PGRUsage ru0;
/*
* Prune all HOT-update chains in this page.
*
- * We count tuples removed by the pruning step as removed by VACUUM.
+ * We count tuples removed by the pruning step as removed by VACUUM
+ * (existing LP_DEAD line pointers don't count).
*/
tups_vacuumed += heap_page_prune(onerel, buf, vistest, false,
InvalidTransactionId, 0,
ItemPointerSet(&(tuple.t_self), blkno, offnum);
/*
- * DEAD line pointers are to be vacuumed normally; but we don't
+ * LP_DEAD line pointers are to be vacuumed normally; but we don't
* count them in tups_vacuumed, else we'd be double-counting (at
* least in the common case where heap_page_prune() just freed up
- * a non-HOT tuple).
+ * a non-HOT tuple). Note also that the final tups_vacuumed value
+ * might be very low for tables where opportunistic page pruning
+ * happens to occur very frequently (via heap_page_prune_opt()
+ * calls that free up non-HOT tuples).
*/
if (ItemIdIsDead(itemid))
{
vacrelstats->relname,
tups_vacuumed, vacuumed_pages)));
- /*
- * This is pretty messy, but we split it up so that we can skip emitting
- * individual parts of the message when not applicable.
- */
initStringInfo(&buf);
appendStringInfo(&buf,
_("%.0f dead row versions cannot be removed yet, oldest xmin: %u\n"),