Re: Track skipped tables during autovacuum and autoanalyze

From: vignesh C <vignesh21(at)gmail(dot)com>
To: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Sami Imseih <samimseih(dot)pg(at)gmail(dot)com>, Shinya Kato <shinya11(dot)kato(at)gmail(dot)com>
Subject: Re: Track skipped tables during autovacuum and autoanalyze
Date: 2026-11-05 16:10:17
Message-ID: CALDaNm0+J2dG5h3mX0AqqV=cO-vcZC0qXH_+7ypQ1TNWDVQhNQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 5 Nov 2026 at 07:56, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> wrote:
>
> On Thu, 5 Nov 2026 07:16:45 +0900
> Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> > On Wed, Nov 04, 2026 at 03:55:31PM -0600, Zsolt Parragi wrote:
> > > I have only one small comment/question: it seems like the
> > > PGSTAT_FILE_FORMAT_ID change was dropped between v14 and v15?
> >
> > That would be the kind of thing a committer would take care of once/if
> > committing such a patch. I'd suggest to add a notice to the commit
> > message of the sent patch instead, to not forget that the counter
> > needs a bump when/if it gets merged.
>
> Thank you for the suggestion.
>
> Attached is an updated patch with only the suggested comment added.

Thanks for the updated patch.
I reviewed v20 and found that a skip is recorded before any privilege
checks are performed. While a lock is held on a table, any role that
can see the table's schema can run:
VACUUM (SKIP_LOCKED) t;
ANALYZE (SKIP_LOCKED) t;

This allows the role to increment t's lock_skipped_vacuum_count /
lock_skipped_analyze_count and update the corresponding
last_lock_skipped_* timestamps, even if it has no privileges on the
table. Since it allows an unprivileged role to modify the shared
statistics of a table it cannot access.
Attached a patch which has the test to reproduce this issue.
Thoughts?

Regards,
Vignesh

Attachment Content-Type Size
0001-Add-isolation-test-for-lock-skip-statistics-and-priv.patch application/octet-stream 5.2 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2026-11-05 16:59:36 Re: Credits For v19
Previous Message Ruohang Feng 2026-11-05 16:01:21 Re: Credits For v19