public inbox for [email protected]  
help / color / mirror / Atom feed
From: Dmitrii Dolgov <[email protected]>
Subject: [PATCH v1 1/2] Add a USDT for tracing nbtree page splits
Date: Mon, 27 Apr 2026 16:53:14 +0200

Add a new USDT nbtree__page__split with a single argument BlockNumber to
trace page splits, which is usefull for experimenting.
---
 src/backend/access/nbtree/nbtinsert.c | 3 +++
 src/backend/utils/probes.d            | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c
index c8af97dd23d..ddb7b47118e 100644
--- a/src/backend/access/nbtree/nbtinsert.c
+++ b/src/backend/access/nbtree/nbtinsert.c
@@ -24,6 +24,7 @@
 #include "common/pg_prng.h"
 #include "lib/qunique.h"
 #include "miscadmin.h"
+#include "pg_trace.h"
 #include "storage/lmgr.h"
 #include "storage/predicate.h"
 #include "utils/injection_point.h"
@@ -2107,6 +2108,8 @@ _bt_split(Relation rel, Relation heaprel, BTScanInsert itup_key, Buffer buf,
 		pfree(lefthighkey);
 
 	/* split's done */
+	TRACE_POSTGRESQL_NBTREE_PAGE_SPLIT(origpagenumber);
+
 	return rbuf;
 }
 
diff --git a/src/backend/utils/probes.d b/src/backend/utils/probes.d
index 1929521c6a5..521b76ec59e 100644
--- a/src/backend/utils/probes.d
+++ b/src/backend/utils/probes.d
@@ -91,4 +91,6 @@ provider postgresql {
 	probe wal__switch();
 	probe wal__buffer__write__dirty__start();
 	probe wal__buffer__write__dirty__done();
+
+	probe nbtree__page__split(BlockNumber);
 };

base-commit: 1a51ec16db7aa1688d0083911db78e17ff7f26ba
-- 
2.52.0


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



view thread (273+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH v1 1/2] Add a USDT for tracing nbtree page splits
  In-Reply-To: <no-message-id-260572@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox