pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Scale VACUUM reltuples estimates after relation growth
2+ messages / 1 participants
[nested] [flat]

* pgsql: Scale VACUUM reltuples estimates after relation growth
@ 2026-11-12 21:12 Melanie Plageman <melanieplageman@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

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

Scale VACUUM reltuples estimates after relation growth

VACUUM kept the old reltuples value when it scanned at most one page,
even if the relation size changed. This left stale estimates after table
growth or shrinkage. Commit b46e1e54d made scanning one page more likely
by allowing newly populated pages to become all-visible before VACUUM.

Preserve reltuples only when relation size is unchanged; otherwise, scale
the old tuple density to the current size.

Only backpatch as far as 19, even though it was present before, to avoid
changing stats logic in stable branches.

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/eacabd7d031cdc449ae7938dd8b75e6edb3d03b8

Modified Files
--------------
src/backend/commands/vacuum.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)



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

* pgsql: Scale VACUUM reltuples estimates after relation growth
@ 2026-11-12 21:14 Melanie Plageman <melanieplageman@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

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

Scale VACUUM reltuples estimates after relation growth

VACUUM kept the old reltuples value when it scanned at most one page,
even if the relation size changed. This left stale estimates after table
growth or shrinkage. Commit b46e1e54d made scanning one page more likely
by allowing newly populated pages to become all-visible before VACUUM.

Preserve reltuples only when relation size is unchanged; otherwise, scale
the old tuple density to the current size.

Only backpatch as far as 19, even though it was present before, to avoid
changing stats logic in stable branches.

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/baa86d46a186d56d2377e2946ac7ce6e8ed1e0be

Modified Files
--------------
src/backend/commands/vacuum.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)



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


end of thread, other threads:[~2026-11-12 21:14 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:12 pgsql: Scale VACUUM reltuples estimates after relation growth Melanie Plageman <melanieplageman@gmail.com>
2026-11-12 21:14 pgsql: Scale VACUUM reltuples estimates after relation growth 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