Re: Vacuum statistics

From: Alena Rybakina <lena(dot)ribackina(at)yandex(dot)ru>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Jim Nasby <jnasby(at)upgrade(dot)com>, Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>, Kirill Reshke <reshkekirill(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, Sami Imseih <samimseih(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>, Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>, Andrey Borodin <x4mmm(at)yandex-team(dot)ru>, Andrei Zubkov <zubkov(at)moonset(dot)ru>, Andrei Lepikhov <lepihov(at)gmail(dot)com>
Subject: Re: Vacuum statistics
Date: 2026-06-16 15:09:53
Message-ID: a611e91e-073d-49fe-aeb1-45d1a505b78f@yandex.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, all!

Attached is a reworked version of the patch set. The main change is that the
statistics are no longer exposed through a contrib extension; they are now
built-in system views - pg_stat_vacuum_tables, pg_stat_vacuum_indexes and
pg_stat_vacuum_database - backed by pg_stat_get_vacuum_*() functions and
stored
in the cumulative statistics system under a dedicated stats kind
(PGSTAT_KIND_VACUUM_RELATION). Collection is controlled by a single
track_vacuum_statistics GUC; the per-relation tracking list, the reset
function and the shared-memory-size helper from the extension version
are gone.

The series is also split into smaller, self-contained commits - one per
metric
category (core heap/tuple counters, missed dead tuples/pages, visibility-map
transitions, the buffer/WAL/timing sampling machinery, per-relation buffers,
timing and the wraparound failsafe, and WAL) - with the documentation and
tests growing inside each commit.

Other changes:

* index statistics are accumulated across the bulkdelete and cleanup
passes and reported once per index, in both the serial and parallel
paths;
* index_vacuum_count is no longer exposed;
* the regression coverage is now an in-core vacuum_stats test with
deterministic checks and dedicated scenarios for the non-trivial
paths (truncation, freeze, cost delay, WAL full-page images, index
page deletion), an isolation test for recently_dead/missed_dead
tuples, and a xid_wraparound TAP test for the failsafe counter.

--
-----------
Best regards,
Alena Rybakina
Yandex Cloud

Attachment Content-Type Size
0001-Track-table-VM-stability.patch text/plain 21.9 KB
0002-Extended-vacuum-statistics-core-heap-and-tuple-metri.patch text/plain 49.3 KB
0003-Extended-vacuum-statistics-missed-dead-tuples-and-pa.patch text/plain 15.6 KB
0004-Extended-vacuum-statistics-visibility-map-page-trans.patch text/plain 12.8 KB
0005-Extended-vacuum-statistics-buffer-WAL-timing-machine.patch text/plain 66.4 KB
0006-Extended-vacuum-statistics-per-relation-buffer-acces.patch text/plain 16.4 KB
0007-Extended-vacuum-statistics-timing-metrics-and-failsa.patch text/plain 35.3 KB
0008-Extended-vacuum-statistics-WAL-metrics-for-tables-in.patch text/plain 29.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Baji Shaik 2026-06-16 15:14:09 Re: [PATCH] COPY TO FORMAT json: respect column list order
Previous Message Tom Lane 2026-06-16 15:07:23 Re: Direction for test frameworks: Perl TAP vs. Python/pytest