diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index b403fb990a7..4c1d4b2a80a 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -6806,8 +6806,8 @@ FROM pg_stat_get_backend_idset() AS backendid;
cluster_index_relid oid
- If the table is being scanned using an index, this is the OID of the
- index being used; otherwise, it is zero.
+ OID of the index defining the order of the rewritten table, or zero
+ if no index ordering is requested.
@@ -7480,8 +7480,8 @@ FROM pg_stat_get_backend_idset() AS backendid;
repack_index_relid oid
- If the table is being scanned using an index, this is the OID of the
- index being used; otherwise, it is zero.
+ OID of the index defining the order of the rewritten table, or zero
+ if no index ordering is requested.
diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c
index 0f24a132564..dd2218bbbaf 100644
--- a/src/backend/access/heap/heapam_handler.c
+++ b/src/backend/access/heap/heapam_handler.c
@@ -660,16 +660,8 @@ heapam_relation_copy_for_cluster(Relation OldHeap, Relation NewHeap,
*/
if (OldIndex != NULL && !use_sort)
{
- const int ci_index[] = {
- PROGRESS_REPACK_PHASE,
- PROGRESS_REPACK_INDEX_RELID
- };
- int64 ci_val[2];
-
- /* Set phase and OIDOldIndex to columns */
- ci_val[0] = PROGRESS_REPACK_PHASE_INDEX_SCAN_HEAP;
- ci_val[1] = RelationGetRelid(OldIndex);
- pgstat_progress_update_multi_param(2, ci_index, ci_val);
+ pgstat_progress_update_param(PROGRESS_REPACK_PHASE,
+ PROGRESS_REPACK_PHASE_INDEX_SCAN_HEAP);
tableScan = NULL;
heapScan = NULL;
diff --git a/src/backend/commands/repack.c b/src/backend/commands/repack.c
index 57f28f1a420..6f7c37c39b2 100644
--- a/src/backend/commands/repack.c
+++ b/src/backend/commands/repack.c
@@ -511,6 +511,11 @@ cluster_rel(RepackCommand cmd, Relation OldHeap, Oid indexOid,
bool recheck = ((params->options & CLUOPT_RECHECK) != 0);
bool concurrent = ((params->options & CLUOPT_CONCURRENT) != 0);
Oid ident_idx = InvalidOid;
+ const int progress_index[] = {
+ PROGRESS_REPACK_COMMAND,
+ PROGRESS_REPACK_INDEX_RELID
+ };
+ const int64 progress_values[] = {cmd, indexOid};
/* Determine the lock mode to use. */
lmode = RepackLockLevel(concurrent);
@@ -526,7 +531,8 @@ cluster_rel(RepackCommand cmd, Relation OldHeap, Oid indexOid,
CHECK_FOR_INTERRUPTS();
pgstat_progress_start_command(PROGRESS_COMMAND_REPACK, tableOid);
- pgstat_progress_update_param(PROGRESS_REPACK_COMMAND, cmd);
+ /* Report the ordering index even when using a sequential scan and sort. */
+ pgstat_progress_update_multi_param(2, progress_index, progress_values);
/*
* Switch to the table owner's userid, so that any index functions are run