| From: | Melanie Plageman <melanieplageman(at)gmail(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Exclude new pages from VACUUM reltuples estimates |
| Date: | 2026-11-13 21:54:46 |
| Message-ID: | E1xRzEM-00000000c3N-1hNG@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Exclude new pages from VACUUM reltuples estimates
VACUUM always scans PageIsNew blocks because they have no visibility map
bits. They could already distort reltuples estimates when all-visible
pages were skipped by successive VACUUMs. However, on-access VM setting
(b46e1e54d) makes this more likely by making it possible that some
all-visible pages will never be scanned by vacuum.
Exclude PageIsNew blocks from the sampled pages and sampleable
population that is used to extrapolate reltuples for the unscanned
pages.
Reported-by: Vaibhav Jain <jainva(at)google(dot)com>
Co-authored-by: Vaibhav Jain <jainva(at)google(dot)com>
Co-authored-by: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Discussion: https://postgr.es/m/flat/CABa-Az2YXuX%2B_JH8VL89i7oA%2BDC74GvfkSsM9%2B92fGCeWYVCqg%40mail.gmail.com
Backpatch-through: 19
Branch
------
REL_19_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/e2b2267d24e79f58ba25f1cd2e168059d2f23c26
Modified Files
--------------
contrib/pgstattuple/pgstatapprox.c | 16 ++++++-
src/backend/access/heap/vacuumlazy.c | 16 +++++--
src/backend/commands/vacuum.c | 28 +++++++----
src/include/commands/vacuum.h | 1 +
src/test/regress/expected/vacuum.out | 93 ++++++++++++++++++++++++++++++++++++
src/test/regress/sql/vacuum.sql | 43 +++++++++++++++++
6 files changed, 183 insertions(+), 14 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2026-11-13 23:11:03 | pgsql: Drop support for named POSIX semaphores (the sem_open() kind). |
| Previous Message | Melanie Plageman | 2026-11-13 21:51:20 | pgsql: Exclude new pages from VACUUM reltuples estimates |