Subject: [PATCH v2 2/3] Add USDT for split location benchmarking

From: Dmitrii Dolgov <[email-masked]>
Date: Mon, 15 Jun 2026 16:39:29 +0200

Add new USDTs probe nbtree__page__findsplit__(start / done) for
benchmarking of split logic.
---
 src/backend/access/nbtree/nbtsplitloc.c | 5 +++++
 src/backend/utils/probes.d              | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/src/backend/access/nbtree/nbtsplitloc.c b/src/backend/access/nbtree/nbtsplitloc.c
index de9eca3c8b2..c64fef5ab27 100644
--- a/src/backend/access/nbtree/nbtsplitloc.c
+++ b/src/backend/access/nbtree/nbtsplitloc.c
@@ -17,6 +17,7 @@
 #include "access/nbtree.h"
 #include "access/tableam.h"
 #include "common/int.h"
+#include "pg_trace.h"
 
 typedef enum
 {
@@ -152,6 +153,8 @@ _bt_findsplitloc(Relation rel,
 	SplitPoint	leftpage,
 				rightpage;
 
+	TRACE_POSTGRESQL_NBTREE_PAGE_FINDSPLIT_START(origpage);
+
 	opaque = BTPageGetOpaque(origpage);
 	maxoff = PageGetMaxOffsetNumber(origpage);
 
@@ -425,6 +428,8 @@ _bt_findsplitloc(Relation rel,
 									 strategy);
 	pfree(state.splits);
 
+	TRACE_POSTGRESQL_NBTREE_PAGE_FINDSPLIT_DONE(origpage);
+
 	return firstrightoff;
 }
 
diff --git a/src/backend/utils/probes.d b/src/backend/utils/probes.d
index d827ed0201c..b90b708d862 100644
--- a/src/backend/utils/probes.d
+++ b/src/backend/utils/probes.d
@@ -94,4 +94,7 @@ provider postgresql {
 
 	probe nbtree__page__split(BlockNumber);
 	probe nbtree__page__truncate(int);
+
+	probe nbtree__page__findsplit__start(Page);
+	probe nbtree__page__findsplit__done(Page);
 };
-- 
2.52.0

--hfljrm32b5osvvug
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: attachment;
	filename="v2-0003-Randomize-nbtree-split-location-to-avoid-oscillat.patch"
Content-Transfer-Encoding: 8bit