[PATCH v1 1/2] Add a USDT for tracing nbtree page splits
Dmitry Dolgov <9erthalion6@gmail.com>
From: Dmitrii Dolgov <9erthalion6@gmail.com>
To:
Date: 2026-04-27T14:53:14Z
Lists: pgsql-hackers
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
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
MSVC: Turn missing function declaration into an error
- 1a51ec16db7a 19 (unreleased) cited