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-22 04:20:29
Message-ID: CAOzEurSdc8vfkAdUkeyKkLq0TGBsJNpv=C=ba+5WkETP-LPpUQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jul 22, 2026 at 3:51 AM Sami Imseih <samimseih(at)gmail(dot)com> wrote:
>
> Sorry, I missed attaching the injection point test.
>
> v11 includes it.

Thanks for the updated patches! I have a few comments.

In 0001,

> +step check_stat
> +{
> + SELECT relname,
> + vacuum_count, lock_skipped_vacuum_count,
> + analyze_count, lock_skipped_analyze_count
> + FROM pg_stat_all_tables
> + WHERE relname IN ('parted', 'part1', 'part2');
> +}

How about adding "ORDER BY relname" here? The row order is not
guaranteed otherwise.

> +{ oid => '8142', descr => 'statistics: last skipped vacuum time for a table',
> + proname => 'pg_stat_get_last_lock_skipped_vacuum_time', provolatile => 's',

The proname now says lock_skipped, but the descr still says just
"skipped". I think the descr should mention the lock cause as well,
and the same applies to the other seven entries.

> +#define PGSTAT_REPORT_SKIPPED_VACUUM (1 << 0) /* vacuum is skipped */
> +#define PGSTAT_REPORT_SKIPPED_ANALYZE (1 << 1) /* analyze is skipped */

The struct fields were renamed to lock_skipped_*, but these flags and
pgstat_report_skipped_vacuum_analyze() keep the generic name. Should
we rename them too, for consistency?

In 0002,

> + 'vacuum_skip_lock_stats',

This also needs to be added to the ISOLATION list in
src/test/modules/injection_points/Makefile. Without it the test never
runs in the autoconf build. I confirmed it passes once registered
there.

--
Best regards,
Shinya Kato
NTT OSS Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Japin Li 2026-07-22 04:22:06 Re: Fix optind handling inconsistency in getopt_long() for missing argument
Previous Message Japin Li 2026-07-22 04:17:47 Re: Fix optind handling inconsistency in getopt_long() for missing argument