pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Avoid extrapolating reltuples from tiny VACUUM samples
2+ messages / 1 participants
[nested] [flat]

* pgsql: Avoid extrapolating reltuples from tiny VACUUM samples
@ 2026-11-12 21:04  Melanie Plageman <melanieplageman@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Melanie Plageman @ 2026-11-12 21:04 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid extrapolating reltuples from tiny VACUUM samples

Since b46e1e54d, on-access pruning can mark most pages all-visible
before VACUUM or ANALYZE establishes tuple density. VACUUM may then scan
only a tiny tail of mostly empty pages while reltuples is still unknown
or reflects a previously empty table.

When no prior density is available, treat a sample of at most one page
or less than two percent of the relation as insufficient and leave
reltuples unknown instead of extrapolating.

Reported-by: Vaibhav Jain <jainva@google.com>
Author: Vaibhav Jain <jainva@google.com>
Reviewed-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/1a001d930ee8a105220b236035a975a166086870

Modified Files
--------------
src/backend/access/heap/vacuumlazy.c |  5 ++---
src/backend/commands/vacuum.c        | 21 ++++++++++++++-------
2 files changed, 16 insertions(+), 10 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Avoid extrapolating reltuples from tiny VACUUM samples
@ 2026-11-12 21:07  Melanie Plageman <melanieplageman@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Melanie Plageman @ 2026-11-12 21:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Avoid extrapolating reltuples from tiny VACUUM samples

Since b46e1e54d, on-access pruning can mark most pages all-visible
before VACUUM or ANALYZE establishes tuple density. VACUUM may then scan
only a tiny tail of mostly empty pages while reltuples is still unknown
or reflects a previously empty table.

When no prior density is available, treat a sample of at most one page
or less than two percent of the relation as insufficient and leave
reltuples unknown instead of extrapolating.

Reported-by: Vaibhav Jain <jainva@google.com>
Author: Vaibhav Jain <jainva@google.com>
Reviewed-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
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/ab79429c26d3980535457cc618c79328a9ebf495

Modified Files
--------------
src/backend/access/heap/vacuumlazy.c |  5 ++---
src/backend/commands/vacuum.c        | 21 ++++++++++++++-------
2 files changed, 16 insertions(+), 10 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-11-12 21:07 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-12 21:04 pgsql: Avoid extrapolating reltuples from tiny VACUUM samples Melanie Plageman <melanieplageman@gmail.com>
2026-11-12 21:07 pgsql: Avoid extrapolating reltuples from tiny VACUUM samples Melanie Plageman <melanieplageman@gmail.com>

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