pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Preserve n_live_tup when VACUUM cannot estimate it
2+ messages / 1 participants
[nested] [flat]

* pgsql: Preserve n_live_tup when VACUUM cannot estimate it
@ 2026-11-12 20:55 Melanie Plageman <melanieplageman@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

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

Preserve n_live_tup when VACUUM cannot estimate it

VACUUM clamped an unknown live-tuple estimate (-1) to zero before
reporting it to pgstat, overwriting any existing n_live_tup estimate
with zero. It did so because some users required non-negative values and
the situation was seen as rare.

Commit b46e1e54d made the sitaution more likely by allowing on-access
pruning to mark pages all-visible before VACUUM or ANALYZE establishes
tuple density.

Pass -1 through to pgstat_report_vacuum(), which will preserve the
existing n_live_tup when the estimate is unknown.

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/49931d8fdc5c88b9bb72b23e95cc976071b6fa14

Modified Files
--------------
src/backend/access/heap/vacuumlazy.c         | 2 +-
src/backend/utils/activity/pgstat_relation.c | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)



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

* pgsql: Preserve n_live_tup when VACUUM cannot estimate it
@ 2026-11-12 20:58 Melanie Plageman <melanieplageman@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

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

Preserve n_live_tup when VACUUM cannot estimate it

VACUUM clamped an unknown live-tuple estimate (-1) to zero before
reporting it to pgstat, overwriting any existing n_live_tup estimate
with zero. It did so because some users required non-negative values and
the situation was seen as rare.

Commit b46e1e54d made the sitaution more likely by allowing on-access
pruning to mark pages all-visible before VACUUM or ANALYZE establishes
tuple density.

Pass -1 through to pgstat_report_vacuum(), which will preserve the
existing n_live_tup when the estimate is unknown.

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/9693c831c1f5fbc2ff437e42a93b0b6274b82105

Modified Files
--------------
src/backend/access/heap/vacuumlazy.c         | 2 +-
src/backend/utils/activity/pgstat_relation.c | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)



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


end of thread, other threads:[~2026-11-12 20:58 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 20:55 pgsql: Preserve n_live_tup when VACUUM cannot estimate it Melanie Plageman <melanieplageman@gmail.com>
2026-11-12 20:58 pgsql: Preserve n_live_tup when VACUUM cannot estimate it 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