[PATCH v1 09/12] prune_xid-hist: collect data from opportunistic pruning

Renan Alves Fonseca <renanfonseca@gmail.com>

From: "Renan A. Fonseca" <renanfonseca@gmail.com>
To:
Date: 2025-05-30T19:45:08Z
Lists: pgsql-hackers
---
 src/backend/access/heap/pruneheap.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/backend/access/heap/pruneheap.c b/src/backend/access/heap/pruneheap.c
index a8025889be0..44a8c2790a3 100644
--- a/src/backend/access/heap/pruneheap.c
+++ b/src/backend/access/heap/pruneheap.c
@@ -285,6 +285,11 @@ heap_page_prune_opt(Relation relation, Buffer buffer)
 		/* And release buffer lock */
 		LockBuffer(buffer, BUFFER_LOCK_UNLOCK);
 
+		if (prune_xid != ((PageHeader) page)->pd_prune_xid)
+			pgstat_update_relation_prune_xid_histogram(relation,
+													   prune_xid,
+													   ((PageHeader) page)->pd_prune_xid);
+
 		/*
 		 * We avoid reuse of any free space created on the page by unrelated
 		 * UPDATEs/INSERTs by opting to not update the FSM at this point.  The
-- 
2.47.0


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
 filename=v1-0010-prune_xid-hist-collect-data-from-vacuum.patch