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 <[email protected]> Author: Vaibhav Jain <[email protected]> Reviewed-by: Melanie Plageman <[email protected]> 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(-)
