Re: Add mode column to pg_stat_progress_vacuum

From: Shinya Kato <shinya11(dot)kato(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, Robert Treat <rob(at)xzilla(dot)net>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Add mode column to pg_stat_progress_vacuum
Date: 2025-10-30 07:38:30
Message-ID: CAOzEurRf5ARdqr9+MjNyxrztZax6TpMynb3jrK9pHt9J-24eAg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 30, 2025 at 8:40 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)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

Attachment Content-Type Size
v3-0001-Add-mode-and-triggered_by-columns-to-pg_stat_prog.patch application/octet-stream 11.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2025-10-30 07:44:23 Re: Sequence Access Methods, round two
Previous Message Michael Paquier 2025-10-30 06:57:13 Re: Add wal_fpi_bytes_[un]compressed to pg_stat_wal