Re: Add mode column to pg_stat_progress_vacuum

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Sami Imseih <samimseih@gmail.com>
Cc: Shinya Kato <shinya11.kato@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>, Nathan Bossart <nathandbossart@gmail.com>, Robert Treat <rob@xzilla.net>, pgsql-hackers@postgresql.org
Date: 2025-10-16T05:17:15Z
Lists: pgsql-hackers
On Thu, Oct 09, 2025 at 10:07:17AM -0500, Sami Imseih wrote:
>> IIUC are you suggesting I add such a last_autovacuum_reason column to
>> pg_stat_all_tables, which would be populated with one of the following
>> values?
>> - autovacuum_vacuum_threshold
>> - autovacuum_vacuum_insert_threshold
>> - autovacuum_freeze_max_age
>> - autovacuum_multixact_freeze_max_age
> 
> This should be a separate discussion. But, I would think the
> counters will be n_aggressive, n_wraparound and n_failsafe.

Depends, I guess (separate discussion it should be, but I count not
resist).  If you had this information available in the cumulative
stats, what should be a "correct" set of numbers, and what could be
tuned to redirect the system so as it gets to a better set of numbers.
Wraparound autovacuums, for one, don't seem really relevant 
to know about in an aggregated way.

Coming back to the original proposal.  Knowing about the state we are
kicking an autovacuum worker job for a set of tables in the progress
view would be definitely a nice thing.
--
Michael

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add started_by column to pg_stat_progress_analyze view.

  2. Add mode and started_by columns to pg_stat_progress_vacuum view.