pg_pmu
pg_pmu · Hardware instruction and cycle counters for EXPLAIN ANALYZE.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 102368 | pg_pmu | pg_pmu | 0.1.0 | STAT | PostgreSQL | C |
PostgreSQL · 19
Usage
Sources:
pg_pmu is a headless PostgreSQL 19/master module. Its module identity declares version 0.1.0. It adds hardware instruction and cycle counts to EXPLAIN ANALYZE on Linux and macOS, including participating parallel workers.
Enable and use
Add the library to the existing preload list and restart. There is no CREATE EXTENSION step. PMU requires ANALYZE, which really executes the statement; use read-only examples or the normal safeguards for a modifying statement.
Interpretation and limits
Linux requires kernel.perf_event_paranoid at most 2 or CAP_PERFMON; containers and virtual machines may still deny counters. Failure to obtain or retain counters fails the query rather than returning a plausible count. Linux user-space counts and macOS kernel-inclusive counts are not comparable. Worker counts are already included in execution totals; VERBOSE separates their contribution.
Counts are per statement, not per plan node, and include measurement overhead. Cached prepared plans lack planning counts. auto_explain is outside the interface. pg_pmu.max_nested defaults to 16 and is fixed at server start; exhausted slots or hardware resources raise errors.