Skip to content

pg_uprobe

Session tracing and dynamic probes for PostgreSQL internals

pg_uprobe · Session tracing and dynamic probes for PostgreSQL internals

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102190pg_uprobepg_uprobe0.3STATAGPL-3.0-onlyC

PostgreSQL · 15, 16, 17

Usage

Sources:

pg_uprobe captures query text, plans, per-node execution, waits and locks, and profiles native functions through Frida Gum. Upstream lists PostgreSQL 15–17, Linux and FreeBSD; ARM64 is not tested.

Core Workflow

shared_preload_libraries = 'pg_uprobe'
CREATE EXTENSION pg_uprobe;
SELECT start_session_trace();
SELECT 1;
SELECT stop_session_trace();

Operational Boundaries

Preload the library and restart before creating the extension as a superuser. start_session_trace() and stop_session_trace() delimit a trace. set_uprobe() installs TIME, HIST or MEM probes; list_uprobes() and delete_uprobe() manage them. Native targets must be exported, non-static, non-inline functions. pg_uprobe.data_dir defaults to the server data directory subfolder, and pg_uprobe.trace_file_limit limits trace files. Protect those files because they include query text and plans. Tracing adds overhead and is intended for focused investigations.

Table reader