pgtrace
Event-driven query, lock, failure, and latency observability from PostgreSQL executor hooks.
pgtrace · Event-driven query, lock, failure, and latency observability from PostgreSQL executor hooks.
Overview
PostgreSQL · 15, 16
Usage
Sources:
pgtrace Event-driven query, lock, failure, and latency observability from PostgreSQL executor hooks.
Enablement
Merge pgtrace into the existing preload list, restart PostgreSQL, and then create pgtrace in each database that needs its SQL objects:
Core Workflow
The following example is taken from the reviewed upstream documentation. Adapt object names, paths, credentials, and workload values before use.
Main Objects
The reviewed install surface includes these prominent objects:
| Object | Kind | Operational role |
|---|---|---|
pgtrace_query_stats | VIEW | Inspection or query view created by the extension. |
pgtrace_alien_queries | VIEW | Inspection or query view created by the extension. |
pgtrace_failing_queries | VIEW | Inspection or query view created by the extension. |
pgtrace_latency_histogram | VIEW | Inspection or query view created by the extension. |
pgtrace_metrics | VIEW | Inspection or query view created by the extension. |
pgtrace_query_count | FUNCTION | Callable function from the reviewed install surface. |
pgtrace_reset | FUNCTION | Callable function from the reviewed install surface. |
pgtrace_slow_queries | VIEW | Inspection or query view created by the extension. |
Operations and Boundaries
- The verified PostgreSQL-major evidence covers 15, 16; do not infer unlisted majors.
- Preloading
pgtracechanges cluster startup state; stage configuration and restart changes separately fromCREATE EXTENSION.