Re: Add mode column to pg_stat_progress_vacuum

Shinya Kato <shinya11.kato@gmail.com>

From: Shinya Kato <shinya11.kato@gmail.com>
To: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>, Robert Treat <rob@xzilla.net>, pgsql-hackers@postgresql.org
Date: 2025-10-30T07:38:30Z
Lists: pgsql-hackers

Attachments

On Thu, Oct 30, 2025 at 8:40 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote:
> > I have updated the patch according to your comments. I have modified
> > this to display the behavior mode (normal, aggressive, failsafe) in
> > the mode column,
>
> The new 'mode' column with the possible three values looks good to me.

Thank you for the review!

> >  and the trigger reason (manual, autovacuum,
> > anti-wraparound) in the reason column
>
> Showing 'anti-wraparound' value hides the fact that the process is an
> autovacuum worker. How about 'ant-wraparound_autovacuum',
> 'autovacuum_wraparound', or something along those lines?

I think 'autovacuum_wraparound' is better because it's shorter and
simpler. I've updated the patch to use it.

> Also, we can
> probably find a better column name than 'reason'. How about 'source'
> or 'triggered_by'?

I've changed it to use 'triggered_by' because 'source' is overloaded
and can be interpreted as data origin, I/O source, or WAL source in
other contexts, making it ambiguous. Also, I've updated the docs from
"The reason why the current vacuum started" to "The trigger of the
current vacuum operation".

> I think we need to update the documentation in maintenance.sgml as
> well. For instance, we can add the reference to the new columns in the
> following description:
>
>       <para>
>        Autovacuum workers generally don't block other commands.  If a process
>        attempts to acquire a lock that conflicts with the
>        <literal>SHARE UPDATE EXCLUSIVE</literal> lock held by autovacuum, lock
>        acquisition will interrupt the autovacuum.  For conflicting lock modes,
>        see <xref linkend="table-lock-compatibility"/>.  However, if
> the autovacuum
>        is running to prevent transaction ID wraparound (i.e., the
> autovacuum query
>        name in the <structname>pg_stat_activity</structname> view ends with
>        <literal>(to prevent wraparound)</literal>), the autovacuum is not
>        automatically interrupted.
>       </para>

I've added a reference to the triggered_by column in the
pg_stat_progress_vacuum view.

-- 
Best regards,
Shinya Kato
NTT OSS Center