Re: parallel autovacuum: Propagate track_cost_delay_timing to parallel workers - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: parallel autovacuum: Propagate track_cost_delay_timing to parallel workers
Date
Msg-id CALj2ACVR=-ykNePS4iQOmPFC7oeUqAt6Ab_+EBw903hspg+LtQ@mail.gmail.com
Whole thread
In response to Re: parallel autovacuum: Propagate track_cost_delay_timing to parallel workers  (Sami Imseih <samimseih.pg@gmail.com>)
Responses Re: parallel autovacuum: Propagate track_cost_delay_timing to parallel workers
List pgsql-hackers
Hi,

On Mon, Sep 28, 2026 at 5:13 PM Sami Imseih <samimseih.pg@gmail.com> wrote:
>
> > > track_cost_delay_timing gates delay timing reporting elsewhere, so we should not
> > > deviate from that. If the GUC is off by then, we should not accumulate
> > > any timing
> > > anyhow, even if parallel_vacuum_worker_delay_ns > 0
> >
> > IIUC the remaining parallel_vacuum_worker_delay_ns was accumulated
> > when the track_cost_delay_timing was enabled. Shouldn't we report it
> > as well?
>
> We could swap
> ```
> /* Report any remaining cost-based vacuum delay time */
> if (track_cost_delay_timing)
> ```
>
> with
>
> ```
> /* Report any remaining cost-based vacuum delay time */
> if (parallel_vacuum_worker_delay_ns)
> ```
>
> but I did not think that made sense. When we get to the point of reporting
> the remaining time, and the track_cost_delay_timing is disabled, then
> I don't think we should report anything.

I think it depends on how much accumulated time it will be at max from
the last report till the end of parallel_vacuum_main(). If it is in
minutes or even tens of seconds, then losing that last part would make
the reported delay time incomplete.

That said, I checked track_wal_io_timing and it reports the
accumulated timing even after the GUC is turned off, see
pgstat_count_io_op_time(). IIUC, what matters there is whether timing
was on when the start time was captured, not what it is at reporting
time. Looking at that, I would prefer reporting the remaining
accumulated time here too to make it complete.

Also, +1 to rename track_delay_timing to GUC name.

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



pgsql-hackers by date:

Previous
From: "Hayato Kuroda (Fujitsu)"
Date:
Subject: RE: Fix apply worker crash when subscriber table has only a deferrable primary key
Next
From: "Tristan Partin"
Date:
Subject: Fix out-of-bounds array indexing in JsonValueList