Re: Allow progress tracking of sub-commands

From: Rahila Syed <rahilasyed90(at)gmail(dot)com>
To: Antonin Houska <ah(at)cybertec(dot)at>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, bharath(dot)rupireddyforpostgres(at)gmail(dot)com, mihailnikalayeu(at)gmail(dot)com, adam8157(at)gmail(dot)com
Subject: Re: Allow progress tracking of sub-commands
Date: 2026-06-29 16:03:02
Message-ID: CAH2L28sbOsY_3-2J+=UCg9GFvgZjf_Ohu9y1Nk26ME9ieHc4rw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Antonin,

Thanks for suggesting enhancements to the progress reporting framework.

I have comments on the solution's approach.

/*
+ * Some commands have a sub-command, e.g. REPACK (re)builds indexes. The
+ * target can be different, e.g. when the sub-command builds an index on
+ * TOAST relation.
+ */
+ ProgressCommandType st_progress_command2;
+ Oid st_progress_command_target2;
+ int64 st_progress_param2[PGSTAT_NUM_PROGRESS_PARAM];

This approach only works for a nesting depth of 2, not for 3 or more
levels of subcommands, for instance.
I am not aware of a concrete example of such a command but I think we should
keep the design generic enough to accommodate this.

Shall we consider reporting the progress counters of a sub-command as
additional parameters
in the existing st_progress_param[] array? A top level command can
define the progress parameters
based on the number and type of sub-commands it expects to see. This
way we can even restrict or alter the counters we would like to report
for a sub-command. This also avoids changing PgBackendStatus every
time we encounter a command requiring deeper nesting levels.

Thank you,
Rahila Syed

On Mon, 29 Jun 2026 at 19:57, Antonin Houska <ah(at)cybertec(dot)at> wrote:
>
> I've noticed several complaints about two commands trying to report their
> progress at the same time, overwriting each other's output [1][2][3]. I posted
> a prototype of an enhancement of the monitoring infrastructure that allows for
> progress reporting of two commands w/o conflicts [4].
>
> This is a new version that passes regression tests. I'll register it for the
> upcoming CF.
>
>
> [1] https://www.postgresql.org/message-id/5667.1774513434%40localhost
> [2] https://www.postgresql.org/message-id/CALj2ACUgwSchK6jQ2CdKLBWUADTOE_zKdTff2Zg3E6hOuXKv-w%40mail.gmail.com
> [3] https://www.postgresql.org/message-id/aj4gJQMba0kClQmj%40Mac
> [4] https://www.postgresql.org/message-id/30939.1777888333%40localhost
>
> --
> Antonin Houska
> Web: https://www.cybertec-postgresql.com
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Previous Message vignesh C 2026-06-29 16:01:14 Re: Fix publisher-side sequence permission reporting