Save prune cycles by consistently clearing prune hints on all-visible pages
Melanie Plageman <melanieplageman@gmail.com>
Author:
Melanie Plageman <melanieplageman@gmail.com>
Date: 2026-03-02T16:05:59Z
Releases:
19 (unreleased)
Save prune cycles by consistently clearing prune hints on all-visible pages All-visible pages can't contain prunable tuples. We already clear the prune hint (pd_prune_xid) during pruning of all-visible pages, but we were not doing so in vacuum phase three, nor initializing it for all-frozen pages created by COPY FREEZE, and we were not clearing it on standbys. Because page hints are not WAL-logged, pages on a standby carry stale pd_prune_xid values. After promotion, that stale hint triggers unnecessary on-access pruning. Fix this by clearing the prune hint everywhere we currently mark a heap page all-visible. Clearing it when setting PD_ALL_VISIBLE ensures no extra overhead. Author: Melanie Plageman <melanieplageman@gmail.com> Reviewed-by: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/flat/CAAKRu_b-BMOyu0X-0jc_8bWNSbQ5K6JTEueayEhcQuw-OkCSKg%40mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/access/heap/heapam.c | modified | +1 −0 |
| src/backend/access/heap/heapam_xlog.c | modified | +7 −0 |
| src/backend/access/heap/vacuumlazy.c | modified | +3 −0 |
Discussion
Cited messages not in the archive:
flat/CAAKRu_b-BMOyu0X-0jc_8bWNSbQ5K6JTEueayEhcQuw-OkCSKg@mail.gmail.com