BPF-based PostgreSQL wait event tracer using hardware watchpoints
// readme
pg_wait_tracer
Working on this repository after 2026-11-10?
docs/HANDOVER_2026-11-10.mdis the handover: open release blockers, open PRs, the decisions left unmade, and where the measurement evidence lives.docs/OPERATING_MODEL.mddescribes how the work was run.
Real-time, tiered PostgreSQL wait event tracer.
pg_wait_tracer attaches to a running PostgreSQL cluster and observes wait events across all backends. It requires no PostgreSQL patches, no extensions, and no restarts.
It runs in two tiers (default --mode tiered):
- An always-on, low-overhead sampled tier (ASH-style, pure userspace via
process_vm_readvβ ~0% impact on PostgreSQL) that you leave running 24/7. - On-demand or anomaly-triggered escalation to the exact
hardware-watchpoint tier, which captures every
wait_event_infotransition with nanosecond precision during bounded, budgeted windows.
This gives you Active Session History continuously, plus exact, every-transition detail exactly when you need it β without paying the watchpoint overhead all the time. The samplerβs top-5 wait-event ranking matches the exact tierβs (5/5 events, every rate, every run measured)β¦