dventimi@pg_flight_recorder

v2.26.3Created 3 months agoBy dventimi

pg_flight_recorder

Server-side flight recorder for PostgreSQL. Answers "what was happening in my database?"

Install

Requires PostgreSQL 15+ with pg_cron.

Download from GitHub Releases or clone the repo, then:

# Core (tables, collection, scheduling)
psql --single-transaction -f install.sql
# Control (optional — vacuum diagnostics, scale factor tuning, bloat analysis)
psql --single-transaction -f autovacuum_control.sql
# Reporting & analysis (optional)
psql --single-transaction -f reporting.sql

Use

SELECT flight_recorder_reporting.report('1 hour');

That's it. It runs automatically. The report tells you what happened.

Uninstall

# Remove everything (destructive)
psql --single-transaction -f uninstall.sql
# Remove only control functions (keeps core + data)
psql --single-transaction -f uninstall_autovacuum_control.sql
# Remove only reporting functions (keeps core + data)
psql --single-transaction -f uninstall_reporting.sql

Export

With default retention: ~2.5GB uncompressed, ~150MB compressed.

# Without compression
pg_dump -d your_database -n flight_recorder --data-only -f flight_recorder_data.sql
# With compression (PostgreSQL 16+)
pg_dump -d your_database -n flight_recorder --data-only --compress=gzip:9 -f flight_recorder_data.sql.gz
# With compression (PostgreSQL 15)
pg_dump -d your_database -n flight_recorder --data-only | gzip > flight_recorder_data.sql.gz

Reference

See REFERENCE.md for configuration, functions, and details.

Install

  1. Install the dbdev CLI
  2. Generate migration:
dbdev add -o ./migrations -s extensions -v 2.26.3 package -n "dventimi@pg_flight_recorder"

Downloads

  • 0 all time downloads
  • 0 downloads in the last 30 days
  • 0 downloads in the last 90 days
  • 0 downloads in the last 180 days