pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pg_stat_progress_cluster: do not default to CLUSTER
7+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2026-09-10 4dd037286e e418e8eb92  Fix REPACK command reporting in pg_stat_progress_cluster
  2026-09-10 054c1c3e65 d1f742d5d1  Fix pg_stat_progress_cluster command reporting for unprivileged users
* pg_stat_progress_cluster: do not default to CLUSTER
@ 2026-09-03 10:38 Zsolt Parragi <zsolt.parragi@percona.com>
  2026-09-08 23:46 ` Re: pg_stat_progress_cluster: do not default to CLUSTER Fujii Masao <masao.fujii@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Zsolt Parragi @ 2026-09-03 10:38 UTC (permalink / raw)
  To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Álvaro Herrera <alvherre@kurilemu.de>

Hello

Since ac58465e061, pg_stat_progress_cluster is not built on
pg_stat_get_progress_info() but on pg_stat_progress_repack, and maps
the new REPACK command name back onto the two names the view used to
report. The mapping is a CASE ending in an unconditional ELSE
'CLUSTER'.

pg_stat_get_progress_info() hands pid and datid to every caller, but
NULLs other parameters if the caller no has privileges of the role
running the command.

That includes both command and repack_index_relid used in that CASE,
and we can display a VACUUM (FULL) as CLUSTER because of this default
branch.

The attached patch fixes this to report NULL instead. I also attached
a (LLM generated) script that reproduces the issue.

Attachments:

  J4-1.sql (application/octet-stream, 5.3K) download

0001-Don-t-report-CLUSTER-for-a-redacted-progress-row.patch (application/octet-stream, 2.8K) download From 94b9cad50af75c4feb32fb0bace717ed56364d73 Mon Sep 17 00:00:00 2001 From: Zsolt Parragi <zsolt.parragi@percona.com> Date: Thu, 3 Sep 2026 07:44:07 +0000 Subject: [PATCH] Don't report CLUSTER for a redacted progress row Since ac58465e061, pg_stat_progress_cluster is not built on pg_stat_get_progress_info() but on pg_stat_progress_repack, and maps the new REPACK command name back onto the two names the view used to report. The mapping is a CASE ending in an unconditional ELSE 'CLUSTER'. pg_stat_get_progress_info() hands pid and datid to every caller, but NULLs relid and all ten parameters unless the caller has privileges of the role running the command. On such a row both command and repack_index_relid arrive NULL, no WHEN matches, and the ELSE names a command the caller is not entitled to see: a role watching a VACUUM FULL it holds nothing on reads NULL from pg_stat_progress_repack and 'CLUSTER' from pg_stat_progress_cluster in the same instant. The view this one replaced spelled the column as a CASE over param1 with no ELSE, so it reported NULL, as do all the other progress views. Fix by keying every arm on a command name, leaving a withheld one NULL. --- src/backend/catalog/system_views.sql | 5 +++-- src/test/regress/expected/rules.out | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql index 8612d99a890..ad340887f54 100644 --- a/src/backend/catalog/system_views.sql +++ b/src/backend/catalog/system_views.sql @@ -1397,8 +1397,9 @@ CREATE VIEW pg_stat_progress_cluster AS datname, relid, CASE WHEN command IN ('CLUSTER', 'VACUUM FULL') THEN command - WHEN repack_index_relid = 0 THEN 'VACUUM FULL' - ELSE 'CLUSTER' END AS command, + WHEN command = 'REPACK' AND repack_index_relid = 0 THEN 'VACUUM FULL' + WHEN command = 'REPACK' THEN 'CLUSTER' + END AS command, phase, repack_index_relid AS cluster_index_relid, heap_tuples_scanned, diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out index 1a29d46213e..4a8cc759d7b 100644 --- a/src/test/regress/expected/rules.out +++ b/src/test/regress/expected/rules.out @@ -2038,8 +2038,9 @@ pg_stat_progress_cluster| SELECT pid, relid, CASE WHEN (command = ANY (ARRAY['CLUSTER'::text, 'VACUUM FULL'::text])) THEN command - WHEN (repack_index_relid = (0)::oid) THEN 'VACUUM FULL'::text - ELSE 'CLUSTER'::text + WHEN ((command = 'REPACK'::text) AND (repack_index_relid = (0)::oid)) THEN 'VACUUM FULL'::text + WHEN (command = 'REPACK'::text) THEN 'CLUSTER'::text + ELSE NULL::text END AS command, phase, repack_index_relid AS cluster_index_relid, -- 2.55.0
^ permalink raw reply [nested|flat] 7+ messages in thread

* Re: pg_stat_progress_cluster: do not default to CLUSTER
  2026-09-03 10:38 pg_stat_progress_cluster: do not default to CLUSTER Zsolt Parragi <zsolt.parragi@percona.com>
@ 2026-09-08 23:46 ` Fujii Masao <masao.fujii@gmail.com>
  2026-09-09 04:02   ` Re: pg_stat_progress_cluster: do not default to CLUSTER Chao Li <li.evan.chao@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Fujii Masao @ 2026-09-08 23:46 UTC (permalink / raw)
  To: Zsolt Parragi <zsolt.parragi@percona.com>; +Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Álvaro Herrera <alvherre@kurilemu.de>

On Thu, Sep 3, 2026 at 7:39 PM Zsolt Parragi <zsolt.parragi@percona.com> wrote:
> The attached patch fixes this to report NULL instead.

Thanks for the patch! It looks good to me. So, barring any objections,
I'll commit it.

BTW, as a separate issue, is the following also problematic?

    WHEN command = 'REPACK' AND repack_index_relid = 0 THEN 'VACUUM FULL'

REPACK ... USING INDEX ... should basically be displayed as "CLUSTER".
But, if an index scan is not used (for example, when
enable_indexscan is disabled), repack_index_relid can be 0, causing
it to be displayed as "VACUUM FULL" unexpectedly. Thoughts?

Regards,

-- 
Fujii Masao






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: pg_stat_progress_cluster: do not default to CLUSTER
  2026-09-03 10:38 pg_stat_progress_cluster: do not default to CLUSTER Zsolt Parragi <zsolt.parragi@percona.com>
  2026-09-08 23:46 ` Re: pg_stat_progress_cluster: do not default to CLUSTER Fujii Masao <masao.fujii@gmail.com>
@ 2026-09-09 04:02   ` Chao Li <li.evan.chao@gmail.com>
  2026-09-09 06:55     ` Re: pg_stat_progress_cluster: do not default to CLUSTER Fujii Masao <masao.fujii@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Chao Li @ 2026-09-09 04:02 UTC (permalink / raw)
  To: Fujii Masao <masao.fujii@gmail.com>; +Cc: Zsolt Parragi <zsolt.parragi@percona.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Álvaro Herrera <alvherre@kurilemu.de>



> On Sep 9, 2026, at 07:46, Fujii Masao <masao.fujii@gmail.com> wrote:
> 
> On Thu, Sep 3, 2026 at 7:39 PM Zsolt Parragi <zsolt.parragi@percona.com> wrote:
>> The attached patch fixes this to report NULL instead.
> 
> Thanks for the patch! It looks good to me. So, barring any objections,
> I'll commit it.

Also looks good to me.

> 
> BTW, as a separate issue, is the following also problematic?
> 
>    WHEN command = 'REPACK' AND repack_index_relid = 0 THEN 'VACUUM FULL'
> 
> REPACK ... USING INDEX ... should basically be displayed as "CLUSTER".
> But, if an index scan is not used (for example, when
> enable_indexscan is disabled), repack_index_relid can be 0, causing
> it to be displayed as "VACUUM FULL" unexpectedly. Thoughts?
> 

Yes, this is true. Now heapam_relation_copy_for_cluster() only sets PROGRESS_REPACK_INDEX_RELID if (OldIndex != NULL && !use_sort). So when enable_indexscan is off, REPACK ... USING INDEX shows VACUUM FULL:
```
REPACK USING INDEX with enable_indexscan = off
SET
 pg_sleep
----------

(1 row)

  pid  | relid  | repack_command | repack_index_relid | compatibility_command |      phase
-------+--------+----------------+--------------------+-----------------------+------------------
 57523 | j4_1.t | REPACK         |                  0 | VACUUM FULL           | rebuilding index
(1 row)
```

When enable_indexscan is on, it show CLUSTER:
```
REPACK USING INDEX with enable_indexscan = on
SET
 pg_sleep
----------

(1 row)

  pid  | relid  | repack_command | repack_index_relid | compatibility_command |      phase
-------+--------+----------------+--------------------+-----------------------+------------------
 57591 | j4_1.t | REPACK         |              16455 | CLUSTER               | rebuilding index
(1 row)
```

So, repack_index_relid now describes the actual scan method but not if index ordering was requested. Maybe we should set PROGRESS_REPACK_INDEX_RELID in cluster_rel() rather than heapam_relation_copy_for_cluster()? Like in the attache diff.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachments:

repack_index_relid-fix.diff (application/octet-stream, 3.0K) download 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; <structfield>cluster_index_relid</structfield> <type>oid</type> </para> <para> - 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. </para></entry> </row> @@ -7480,8 +7480,8 @@ FROM pg_stat_get_backend_idset() AS backendid; <structfield>repack_index_relid</structfield> <type>oid</type> </para> <para> - 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. </para></entry> </row> 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
^ permalink raw reply [nested|flat] 7+ messages in thread

* Re: pg_stat_progress_cluster: do not default to CLUSTER
  2026-09-03 10:38 pg_stat_progress_cluster: do not default to CLUSTER Zsolt Parragi <zsolt.parragi@percona.com>
  2026-09-08 23:46 ` Re: pg_stat_progress_cluster: do not default to CLUSTER Fujii Masao <masao.fujii@gmail.com>
  2026-09-09 04:02   ` Re: pg_stat_progress_cluster: do not default to CLUSTER Chao Li <li.evan.chao@gmail.com>
@ 2026-09-09 06:55     ` Fujii Masao <masao.fujii@gmail.com>
  2026-09-09 08:20       ` Re: pg_stat_progress_cluster: do not default to CLUSTER Chao Li <li.evan.chao@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Fujii Masao @ 2026-09-09 06:55 UTC (permalink / raw)
  To: Chao Li <li.evan.chao@gmail.com>; +Cc: Zsolt Parragi <zsolt.parragi@percona.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Álvaro Herrera <alvherre@kurilemu.de>

On Wed, Sep 9, 2026 at 1:03 PM Chao Li <li.evan.chao@gmail.com> wrote:
> So, repack_index_relid now describes the actual scan method but not if index ordering was requested. Maybe we should set PROGRESS_REPACK_INDEX_RELID in cluster_rel() rather than heapam_relation_copy_for_cluster()? Like in the attache diff.

Thanks for the patch! LGTM.

> it will translate any REPACK command into one of these other two.

If we apply the proposed patch, at the same moment, personally I'd like to
update this description of pg_stat_progress_cluster.command in the docs
so that it clearly explains how REPACK is translated. How about:

    it will translate a REPACK command into CLUSTER if index ordering
is requested,
    or VACUUM FULL otherwise.

Regards,

-- 
Fujii Masao






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: pg_stat_progress_cluster: do not default to CLUSTER
  2026-09-03 10:38 pg_stat_progress_cluster: do not default to CLUSTER Zsolt Parragi <zsolt.parragi@percona.com>
  2026-09-08 23:46 ` Re: pg_stat_progress_cluster: do not default to CLUSTER Fujii Masao <masao.fujii@gmail.com>
  2026-09-09 04:02   ` Re: pg_stat_progress_cluster: do not default to CLUSTER Chao Li <li.evan.chao@gmail.com>
  2026-09-09 06:55     ` Re: pg_stat_progress_cluster: do not default to CLUSTER Fujii Masao <masao.fujii@gmail.com>
@ 2026-09-09 08:20       ` Chao Li <li.evan.chao@gmail.com>
  2026-09-09 09:47         ` Re: pg_stat_progress_cluster: do not default to CLUSTER Zsolt Parragi <zsolt.parragi@percona.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Chao Li @ 2026-09-09 08:20 UTC (permalink / raw)
  To: Fujii Masao <masao.fujii@gmail.com>; +Cc: Zsolt Parragi <zsolt.parragi@percona.com>; PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>; Álvaro Herrera <alvherre@kurilemu.de>



> On Sep 9, 2026, at 14:55, Fujii Masao <masao.fujii@gmail.com> wrote:
> 
> On Wed, Sep 9, 2026 at 1:03 PM Chao Li <li.evan.chao@gmail.com> wrote:
>> So, repack_index_relid now describes the actual scan method but not if index ordering was requested. Maybe we should set PROGRESS_REPACK_INDEX_RELID in cluster_rel() rather than heapam_relation_copy_for_cluster()? Like in the attache diff.
> 
> Thanks for the patch! LGTM.
> 
>> it will translate any REPACK command into one of these other two.
> 
> If we apply the proposed patch, at the same moment, personally I'd like to
> update this description of pg_stat_progress_cluster.command in the docs
> so that it clearly explains how REPACK is translated. How about:
> 
>    it will translate a REPACK command into CLUSTER if index ordering
> is requested,
>    or VACUUM FULL otherwise.

Yes, that makes sense. I added integrated your suggestion into the patch.

PFA v2:

* 0001 - unchanged from v1-0001
* 0002 - the previous diff plus integrating Fujii-san suggested doc change

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/

Attachments: download all (2 files, .tar.gz)

v2-0001-Don-t-report-CLUSTER-for-a-redacted-progress-row.patch (application/octet-stream, 2.8K) download From 4a70cf8465a87222f82d5f8430c2b99d9f9f960a Mon Sep 17 00:00:00 2001 From: Zsolt Parragi <zsolt.parragi@percona.com> Date: Thu, 3 Sep 2026 07:44:07 +0000 Subject: [PATCH v2 1/2] Don't report CLUSTER for a redacted progress row Since ac58465e061, pg_stat_progress_cluster is not built on pg_stat_get_progress_info() but on pg_stat_progress_repack, and maps the new REPACK command name back onto the two names the view used to report. The mapping is a CASE ending in an unconditional ELSE 'CLUSTER'. pg_stat_get_progress_info() hands pid and datid to every caller, but NULLs relid and all ten parameters unless the caller has privileges of the role running the command. On such a row both command and repack_index_relid arrive NULL, no WHEN matches, and the ELSE names a command the caller is not entitled to see: a role watching a VACUUM FULL it holds nothing on reads NULL from pg_stat_progress_repack and 'CLUSTER' from pg_stat_progress_cluster in the same instant. The view this one replaced spelled the column as a CASE over param1 with no ELSE, so it reported NULL, as do all the other progress views. Fix by keying every arm on a command name, leaving a withheld one NULL. --- src/backend/catalog/system_views.sql | 5 +++-- src/test/regress/expected/rules.out | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql index 8612d99a890..ad340887f54 100644 --- a/src/backend/catalog/system_views.sql +++ b/src/backend/catalog/system_views.sql @@ -1397,8 +1397,9 @@ CREATE VIEW pg_stat_progress_cluster AS datname, relid, CASE WHEN command IN ('CLUSTER', 'VACUUM FULL') THEN command - WHEN repack_index_relid = 0 THEN 'VACUUM FULL' - ELSE 'CLUSTER' END AS command, + WHEN command = 'REPACK' AND repack_index_relid = 0 THEN 'VACUUM FULL' + WHEN command = 'REPACK' THEN 'CLUSTER' + END AS command, phase, repack_index_relid AS cluster_index_relid, heap_tuples_scanned, diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out index 1a29d46213e..4a8cc759d7b 100644 --- a/src/test/regress/expected/rules.out +++ b/src/test/regress/expected/rules.out @@ -2038,8 +2038,9 @@ pg_stat_progress_cluster| SELECT pid, relid, CASE WHEN (command = ANY (ARRAY['CLUSTER'::text, 'VACUUM FULL'::text])) THEN command - WHEN (repack_index_relid = (0)::oid) THEN 'VACUUM FULL'::text - ELSE 'CLUSTER'::text + WHEN ((command = 'REPACK'::text) AND (repack_index_relid = (0)::oid)) THEN 'VACUUM FULL'::text + WHEN (command = 'REPACK'::text) THEN 'CLUSTER'::text + ELSE NULL::text END AS command, phase, repack_index_relid AS cluster_index_relid, -- 2.50.1 (Apple Git-155) =
v2-0002-Fix-command-reporting-for-REPACK-using-sequential.patch (application/octet-stream, 4.8K) download From 6cae5f3ebfdad3c354b839e0a5d7836875051199 Mon Sep 17 00:00:00 2001 From: "Chao Li (Evan)" <lic@highgo.com> Date: Wed, 9 Sep 2026 16:14:48 +0800 Subject: [PATCH v2 2/2] Fix command reporting for REPACK using sequential scan and sort pg_stat_progress_cluster uses repack_index_relid to translate REPACK into CLUSTER or VACUUM FULL. However, this field was set only when an index scan was used. When REPACK followed an index's ordering using a sequential scan and sort, the view incorrectly reported VACUUM FULL. Initialize the field from the requested ordering index when starting progress reporting, independently of the scan method. Update the documentation to describe the field's meaning and explain how REPACK is translated in the compatibility view. Suggested-by: Fujii Masao <masao.fujii@gmail.com> Author: Chao Li <lic@highgo.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/CAN4CZFMzy2V_wvRCBW5K8=wVCk1-C7nq=8otXO=u+s_1KZHqyA@mail.gmail.com --- doc/src/sgml/monitoring.sgml | 13 +++++++------ src/backend/access/heap/heapam_handler.c | 12 ++---------- src/backend/commands/repack.c | 8 +++++++- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index b403fb990a7..48db5aec350 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -6787,8 +6787,9 @@ FROM pg_stat_get_backend_idset() AS backendid; The command that is running. Either <command>CLUSTER</command> or <command>VACUUM FULL</command>. Because this view exists for backwards-compatibility purposes only, - it will translate any <command>REPACK</command> command into one of - these other two. + it will translate a <command>REPACK</command> command into + <command>CLUSTER</command> if index ordering is requested, + or <command>VACUUM FULL</command> otherwise. </para></entry> </row> @@ -6806,8 +6807,8 @@ FROM pg_stat_get_backend_idset() AS backendid; <structfield>cluster_index_relid</structfield> <type>oid</type> </para> <para> - 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. </para></entry> </row> @@ -7480,8 +7481,8 @@ FROM pg_stat_get_backend_idset() AS backendid; <structfield>repack_index_relid</structfield> <type>oid</type> </para> <para> - 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. </para></entry> </row> 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 -- 2.50.1 (Apple Git-155) =
^ permalink raw reply [nested|flat] 7+ messages in thread

* Re: pg_stat_progress_cluster: do not default to CLUSTER
  2026-09-03 10:38 pg_stat_progress_cluster: do not default to CLUSTER Zsolt Parragi <zsolt.parragi@percona.com>
  2026-09-08 23:46 ` Re: pg_stat_progress_cluster: do not default to CLUSTER Fujii Masao <masao.fujii@gmail.com>
  2026-09-09 04:02   ` Re: pg_stat_progress_cluster: do not default to CLUSTER Chao Li <li.evan.chao@gmail.com>
  2026-09-09 06:55     ` Re: pg_stat_progress_cluster: do not default to CLUSTER Fujii Masao <masao.fujii@gmail.com>
  2026-09-09 08:20       ` Re: pg_stat_progress_cluster: do not default to CLUSTER Chao Li <li.evan.chao@gmail.com>
@ 2026-09-09 09:47         ` Zsolt Parragi <zsolt.parragi@percona.com>
  2026-09-10 02:57           ` Re: pg_stat_progress_cluster: do not default to CLUSTER Fujii Masao <masao.fujii@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Zsolt Parragi @ 2026-09-09 09:47 UTC (permalink / raw)
  To: Chao Li <li.evan.chao@gmail.com>; +Cc: pgsql-hackers@lists.postgresql.org, Fujii Masao <masao.fujii@gmail.com>

Yes, this is also a good catch/improvement, looks good to me.






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: pg_stat_progress_cluster: do not default to CLUSTER
  2026-09-03 10:38 pg_stat_progress_cluster: do not default to CLUSTER Zsolt Parragi <zsolt.parragi@percona.com>
  2026-09-08 23:46 ` Re: pg_stat_progress_cluster: do not default to CLUSTER Fujii Masao <masao.fujii@gmail.com>
  2026-09-09 04:02   ` Re: pg_stat_progress_cluster: do not default to CLUSTER Chao Li <li.evan.chao@gmail.com>
  2026-09-09 06:55     ` Re: pg_stat_progress_cluster: do not default to CLUSTER Fujii Masao <masao.fujii@gmail.com>
  2026-09-09 08:20       ` Re: pg_stat_progress_cluster: do not default to CLUSTER Chao Li <li.evan.chao@gmail.com>
  2026-09-09 09:47         ` Re: pg_stat_progress_cluster: do not default to CLUSTER Zsolt Parragi <zsolt.parragi@percona.com>
@ 2026-09-10 02:57           ` Fujii Masao <masao.fujii@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Fujii Masao @ 2026-09-10 02:57 UTC (permalink / raw)
  To: Zsolt Parragi <zsolt.parragi@percona.com>; +Cc: Chao Li <li.evan.chao@gmail.com>; pgsql-hackers@lists.postgresql.org

On Wed, Sep 9, 2026 at 6:47 PM Zsolt Parragi <zsolt.parragi@percona.com> wrote:
>
> Yes, this is also a good catch/improvement, looks good to me.

I've pushed the patches. Thanks!

Regards,

-- 
Fujii Masao






^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2026-09-10 02:57 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-03 10:38 pg_stat_progress_cluster: do not default to CLUSTER Zsolt Parragi <zsolt.parragi@percona.com>
2026-09-08 23:46 ` Fujii Masao <masao.fujii@gmail.com>
2026-09-09 04:02   ` Chao Li <li.evan.chao@gmail.com>
2026-09-09 06:55     ` Fujii Masao <masao.fujii@gmail.com>
2026-09-09 08:20       ` Chao Li <li.evan.chao@gmail.com>
2026-09-09 09:47         ` Zsolt Parragi <zsolt.parragi@percona.com>
2026-09-10 02:57           ` Fujii Masao <masao.fujii@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox