Server-side flight recorder for PostgreSQL. Answers "what was happening in my database?"
View the project website
pg_flight_recorder continuously samples PostgreSQL system state in the background via pg_cron -- no external agents, sidecars, or polling required. It captures wait events, active sessions, locks, WAL activity, checkpoints, I/O, table and index stats, query performance, replication state, and configuration changes. When something goes wrong, the data is already there.
Architecture
Flight Recorder collects two types of data:
System What it captures Frequency Retention Sampled Activity Wait events, sessions, locks 1 min Ring buffer: 2h, Archives: 7d Snapshots WAL, checkpoints, I/O, tables, indexes 1 min 30 days
Data flows through ring buffers (hot, low-overhead) into durable archives and aggregates (cold, long-retention). Safety mechanisms -- circuit breaker, load shedding, per-section timeouts, and pg_cron job timeouts -- prevent the recorder from impacting production workloads.
Extensions
Two extensions, each published as a separate dbdev package:
Extension Schema Purpose README pgfr_record pgfr_record Core: tables, collection, scheduling, ring buffers pgfr_record/README.md pgfr_analyze pgfr_analyze Optional: reporting, anomaly detection, time travel pgfr_analyze/README.md
... continue reading