pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Melanie Plageman <melanieplageman@gmail.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Exclude new pages from VACUUM reltuples estimates
Date: Fri, 13 Nov 2026 21:51:20 +0000
Message-ID: <E1xRzB2-00000000c1O-0gsI@gemulon.postgresql.org> (raw)

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@google.com>
Co-authored-by: Vaibhav Jain <jainva@google.com>
Co-authored-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/flat/CABa-Az2YXuX%2B_JH8VL89i7oA%2BDC74GvfkSsM9%2B92fGCeWYVCqg%40mail.gmail.com
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/206e71935e1ed86e6116b118d7b77e78efcff8b8

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(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1xRzB2-00000000c1O-0gsI@gemulon.postgresql.org>
Permalink:  ../E1xRzB2-00000000c1O-0gsI@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xRzB2-00000000c1O-0gsI@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: melanieplageman@gmail.com
  Subject: Re: pgsql: Exclude new pages from VACUUM reltuples estimates
  In-Reply-To: <E1xRzB2-00000000c1O-0gsI@gemulon.postgresql.org>
  References: <E1xRzB2-00000000c1O-0gsI@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox