From 314dd9038593610583e4fe60ab62e0d46ea3be86 Mon Sep 17 00:00:00 2001 From: Melanie Plageman Date: Sat, 30 Dec 2023 16:30:59 -0500 Subject: [PATCH v2 2/6] lazy_scan_skip remove unneeded local var nskippable_blocks nskippable_blocks can be easily derived from next_unskippable_block's progress when compared to the passed in next_block. --- src/backend/access/heap/vacuumlazy.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index c4e0c077694..3b28ea2cdb5 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -1302,8 +1302,7 @@ static BlockNumber lazy_scan_skip(LVRelState *vacrel, Buffer *vmbuffer, BlockNumber next_block, bool *next_unskippable_allvis, bool *skipping_current_range) { - BlockNumber next_unskippable_block = next_block, - nskippable_blocks = 0; + BlockNumber next_unskippable_block = next_block; bool skipsallvis = false; *next_unskippable_allvis = true; @@ -1360,7 +1359,6 @@ lazy_scan_skip(LVRelState *vacrel, Buffer *vmbuffer, BlockNumber next_block, vacuum_delay_point(); next_unskippable_block++; - nskippable_blocks++; } /* @@ -1373,7 +1371,7 @@ lazy_scan_skip(LVRelState *vacrel, Buffer *vmbuffer, BlockNumber next_block, * non-aggressive VACUUMs. If the range has any all-visible pages then * skipping makes updating relfrozenxid unsafe, which is a real downside. */ - if (nskippable_blocks < SKIP_PAGES_THRESHOLD) + if (next_unskippable_block - next_block < SKIP_PAGES_THRESHOLD) *skipping_current_range = false; else { -- 2.37.2