Hi,

On Thu, Aug 20, 2026 at 4:10 PM Michael Paquier <[email protected]> wrote:
>
> On Wed, Aug 19, 2026 at 07:37:00PM -0700, Bharath Rupireddy wrote:
> > I don't think a separate view is the right approach at least for two
> > reasons. One, to know the progress of a vacuum one has to query two
> > views and relate them. Two, since the leader itself participates in
> > vacuuming indexes alongside workers (and will also for parallel heap
> > vacuum), splitting the same command's progress into two views adds
> > complexity. Keeping everything in a single view with one row per
> > worker (as discussed upthread) is simpler. Some fields would be null
> > on worker rows, but documenting this should be sufficient. That said,
> > I'm open to hear more thoughts on this.
>
> Having a single progress view feels like the natural approach here,
> for both the leader and the workers.  The leader triggers the
> existence of the workers, but both leader and workers may finish by
> doing the same job as there could be usually little meaning for a
> leader to stand idle, waiting for all the workers to do the work.
> Such choices are implementation-agnostic, of course; we should not
> lock ourselves.

Thanks for reviewing. After thinking about this for a while, I still
think one row per worker is the better choice, with the tradeoff of
some fields being null on worker rows (similar to leader_pid in
pg_stat_activity). The docs also say "the view will contain one row
for each backend that is currently vacuuming," and in that sense,
parallel workers launched for index vacuum are essentially doing
vacuum too.

Here's what I have. 0001 reports the current index being vacuumed, and
0002 reports the total blocks and done blocks for B-tree indexes. This
helps track vacuum progress for large indexes in production.

Please have a look.

Thanks, Sami, for sharing thoughts. I'm open to hearing from others on
the separate view for worker progress reporting approach.

--
Bharath Rupireddy
Amazon Web Services: https://aws.amazon.com

Attachment: v4-0001-Report-the-index-being-vacuumed-in-pg_stat_progre.patch
Description: Binary data

Attachment: v4-0002-Report-index-block-progress-in-pg_stat_progress_v.patch
Description: Binary data

Reply via email to