From ccbea44294bb3813882052d14a6158302c4b19aa Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Wed, 16 Sep 2026 18:38:37 +0900 Subject: [PATCH] Fix index rebuild progress reporting for REPACK (CONCURRENTLY) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously, during REPACK (CONCURRENTLY), index_rebuild_count in pg_stat_progress_repack and pg_stat_progress_cluster did not advance as indexes were rebuilt. This made it impossible for users monitoring the operation to tell how many indexes had been completed. Fix this by incrementing the count after each index is built on the new heap, so that both views report the number of completed index builds. Author: Fujii Masao Reviewed-by: Álvaro Herrera Discussion: https://postgr.es/m/CAHGQGwFUsrBvTurkSU8TEc=DZTunqteUXrasseqNMT7AMBZKRw@mail.gmail.com Backpatch-through: 19 --- src/backend/commands/repack.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/commands/repack.c b/src/backend/commands/repack.c index 33d243424a3..0f7281f0894 100644 --- a/src/backend/commands/repack.c +++ b/src/backend/commands/repack.c @@ -3559,6 +3559,8 @@ build_new_indexes(Relation NewHeap, Relation OldHeap, List *OldIndexes) result = lappend_oid(result, newindex); index_close(ind, NoLock); + + pgstat_progress_incr_param(PROGRESS_REPACK_INDEX_REBUILD_COUNT, 1); } return result;