From 6e0258c3e31e85526475f46b2e14cbbcbb861909 Mon Sep 17 00:00:00 2001 From: Melanie Plageman Date: Sat, 30 Dec 2023 16:30:59 -0500 Subject: [PATCH v6 1/9] 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 8b320c3f89a..1dc6cc8e4db 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -1103,8 +1103,7 @@ lazy_scan_skip(LVRelState *vacrel, Buffer *vmbuffer, BlockNumber next_block, bool *next_unskippable_allvis, bool *skipping_current_range) { BlockNumber rel_pages = vacrel->rel_pages, - next_unskippable_block = next_block, - nskippable_blocks = 0; + next_unskippable_block = next_block; bool skipsallvis = false; *next_unskippable_allvis = true; @@ -1161,7 +1160,6 @@ lazy_scan_skip(LVRelState *vacrel, Buffer *vmbuffer, BlockNumber next_block, vacuum_delay_point(); next_unskippable_block++; - nskippable_blocks++; } /* @@ -1174,7 +1172,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.39.2