Re: Track skipped tables during autovacuum and autoanalyze

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com>
Cc: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>, Michael Paquier <michael(at)paquier(dot)xyz>, Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Track skipped tables during autovacuum and autoanalyze
Date: 2026-05-15 00:59:18
Message-ID: CAA5RZ0v-xJ5fdTvNOdfokbY10pjjP=x_sfQ6Td30bbooomysaw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Doesn't these also require a PGSTAT_FILE_FORMAT_ID change?

right. that was missed. Fixed in the attached.

> There's also an asymmetric case for the skipped counters, is that intentional?
>
> | Command | `skipped_vacuum_count` |
> `skipped_analyze_count` |
> |-----------------------------------------|------------------------|-------------------------|
> | `VACUUM (FULL, ANALYZE, SKIP_LOCKED) t` | 0 | 1
> |
> | `VACUUM (ANALYZE, SKIP_LOCKED) t` | 1 | 1
> |
> | `VACUUM (FULL, SKIP_LOCKED) t` | 0 | 0

Yeah, this is because vacuum_count and last_vacuum also skip VACUUM FULL.
That was mentioned earlier in the thread.

> > Initially, I was concerned that something might go wrong if a concurrent
> > session performed DROP TABLE or ALTER TABLE RENAME between RangeVarGetRelidExtended()
> > and RangeVarGetRelid(), but I could not find any actual issue. Even when the table
> > name is changed, the correct statistics entry is updated correctly.
>
> A DROP TABLE can cause a missed skip in statistics, which is
> reproducible with a custom injection point and tap test, see the
> attached patch. The race window is quite minimal, but it exists.

If the table is dropped, there are no stats to update. right?

--
Sami

Attachment Content-Type Size
v7-0001-Track-skipped-vacuum-and-analyze-activity-per-rel.patch application/octet-stream 39.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-05-15 01:12:35 Fix bug of COPY (on_error set_null)
Previous Message Etsuro Fujita 2026-05-15 00:55:59 Re: postgres_fdw: restore_stats uses current user's mapping instead of table owner's during ANALYZE