| From: | Melanie Plageman <melanieplageman(at)gmail(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Set pd_prune_xid on insert |
| Date: | 2026-03-30 20:08:50 |
| Message-ID: | E1w7Iuo-002CIv-06@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Set pd_prune_xid on insert
Now that on-access pruning can update the visibility map (VM) during
read-only queries, set the page’s pd_prune_xid hint during INSERT and on
the new page during UPDATE.
This allows heap_page_prune_and_freeze() to set the VM the first time a
page is read after being filled with tuples. This may avoid I/O
amplification by setting the page all-visible when it is still in shared
buffers and allowing later vacuums to skip scanning the page. It also
enables index-only scans of newly inserted data much sooner.
As a side benefit, this addresses a long-standing note in heap_insert()
and heap_multi_insert(): aborted inserts can now be pruned on-access
rather than lingering until the next VACUUM.
Author: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Reviewed-by: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>
Discussion: https://postgr.es/m/flat/CAAKRu_ZMw6Npd_qm2KM%2BFwQ3cMOMx1Dh3VMhp8-V7SOLxdK9-g%40mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/378a216187aea1b488ce60ed07dd1ac5c14a9984
Modified Files
--------------
src/backend/access/heap/heapam.c | 39 ++++++++++++++++++++++-------------
src/backend/access/heap/heapam_xlog.c | 19 ++++++++++++++++-
src/backend/access/heap/pruneheap.c | 18 +++++++---------
3 files changed, 51 insertions(+), 25 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Heikki Linnakangas | 2026-03-30 20:40:20 | pgsql: Use ShmemInitStruct to allocate shmem for semaphores |
| Previous Message | Melanie Plageman | 2026-03-30 19:50:11 | pgsql: Allow on-access pruning to set pages all-visible |