postgres.git / summary / log / commit / refs

commit    0765b48874a3fcabadfcaa493d068ec6507e7fc7
Author:   Fujii Masao <fujii@postgresql.org>
Date:     Wed Sep 16 09:38:37 2026 +0000
First released in: 19.0

    Fix index rebuild progress reporting for REPACK (CONCURRENTLY)
    
    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 <masao.fujii@gmail.com>
    Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
    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 3e972f2cc14..57c156e6805 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; [parent: 4b445479f9e0]