Modern PostgreSQL workloads demand deep visibility into query behavior yet traditional logging and monitoring approaches often introduce significant overhead or fail to provide actionable intelligence.
This session introduces Pgtrace, a lightweight open-source PostgreSQL extension that hooks directly into the executor to capture aggregate query metrics in shared memory with minimal performance impact.
Pgtrace provides:
Per-query fingerprinting with detailed execution statistics
Global metrics for total, failed, and slow queries
A built-in latency histogram
Slow query capture with execution context
SQLSTATE-based failure tracking
Detection of anomalous, inefficient, and previously unseen (“alien”) queries
Unlike heavy external monitoring systems, Pgtrace is intentionally minimal by design, prioritizing low overhead and cross-backend shared memory metrics.
Understand how PostgreSQL executor hooks work and how extensions can instrument query execution safely.
Learn how to design low-overhead observability systems using shared memory in PostgreSQL 15+.
Gain insight into query fingerprinting techniques for aggregate tracking without storing raw queries.
Discover practical approaches to measuring latency, capturing slow queries, and building histograms inside the database.
Learn how to track and analyze failing queries using SQLSTATE error codes.
Explore strategies for detecting anomalous, inefficient, and previously unseen (“alien”) queries.
Understand performance trade-offs and how to keep monitoring lightweight in production environments.