Re: Track skipped tables during autovacuum and autoanalyze

From: Shinya Kato <shinya11(dot)kato(at)gmail(dot)com>
To: Sami Imseih <samimseih(at)gmail(dot)com>
Cc: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Track skipped tables during autovacuum and autoanalyze
Date: 2026-07-11 08:23:58
Message-ID: CAOzEurSn7YDLLNnZW6etRJ167ZG4hvdaYDxeX5qwy+tuOFe4Dw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Sat, May 16, 2026 at 11:29 PM Sami Imseih <samimseih(at)gmail(dot)com> wrote:
> Attached v9.

Thanks for working on this. I read through v9 and I am +1 on the feature.

It does not build against master for me:

pgstat_relation.c: In function ‘pgstat_report_skipped_vacuum_analyze’:
pgstat_relation.c:419:17: error: too few arguments to function
‘pgstat_drop_entry’
419 | pgstat_drop_entry(PGSTAT_KIND_RELATION,
| ^~~~~~~~~~~~~~~~~
In file included from pgstat_relation.c:27:
../../../../src/include/utils/pgstat_internal.h:811:13: note: declared here
811 | extern bool pgstat_drop_entry(PgStat_Kind kind, Oid dboid, uint64 objid,
| ^~~~~~~~~~~~~~~~~
make[4]: *** [<builtin>: pgstat_relation.o] Error 1

pgstat_drop_entry() gained a missing_ok argument in commit 850b9218c8e
[1], so the call in pgstat_report_skipped_vacuum_analyze() needs a
fourth argument. Passing true, the way the function-usage path in
pgstat_function.c now does, builds cleanly.

On the field names: every skip these fields count is a lock skip, but
skipped_vacuum_count, last_skipped_vacuum and friends do not say so.

In the "Add autovacuum_warning to surface concurrent vacuum
collisions" thread [2], I raised another skip worth tracking, an
autovacuum worker skipping a table because another worker is already
vacuuming it, as an early sign that autovacuum is not keeping up.
There it was suggested to expose it as a per-table counter in
pg_stat_all_tables, the same surface this patch builds. That needs its
own discussion and I am not proposing to widen this patch for it.

But since another skip reason may be added later, I think the column
name should make clear the skip is due to lock unavailability. What do
you think?

[1] https://postgr.es/c/850b9218c8e
[2] https://www.postgresql.org/message-id/CALj2ACUYYv_z3C5VkcYmyezbqxUuJ%2B0H1GeNGZqPK3WFexmTYw%40mail.gmail.chttps://postgr.es/c/850b9218c8e

--
Best regards,
Shinya Kato
NTT OSS Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2026-07-11 10:10:10 Re: relfilenode statistics
Previous Message Jelte Fennema-Nio 2026-07-11 08:15:48 Add read-only disconnect_requested GUC for graceful client disconnect