| From: | Melanie Plageman <melanieplageman(at)gmail(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Scale VACUUM reltuples estimates after relation growth |
| Date: | 2026-11-12 21:12:51 |
| Message-ID: | E1xRc6F-00000000Tt8-0kym@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(at)google(dot)com>
Author: Vaibhav Jain <jainva(at)google(dot)com>
Reviewed-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
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/eacabd7d031cdc449ae7938dd8b75e6edb3d03b8
Modified Files
--------------
src/backend/commands/vacuum.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Melanie Plageman | 2026-11-12 21:14:07 | pgsql: Scale VACUUM reltuples estimates after relation growth |
| Previous Message | Melanie Plageman | 2026-11-12 21:07:10 | pgsql: Avoid extrapolating reltuples from tiny VACUUM samples |