Skip to content

pgfr_record

Server-side PostgreSQL performance flight recorder

pg_flight_recorder · Server-side PostgreSQL performance flight recorder

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
6060pgfr_recordpg_flight_recorder2.32.1STATApache-2.0SQL
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
----d--NoNoNoYesnono
Relationships
Schemaspgfr_record
Requirespg_cron
Need Bypgfr_analyze
See Alsopg_stat_log pg_tracing pg_stat_backtrace logerrors pgelog
Siblingspgfr_analyze
Enable with pgfr_record.enable().

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXTPIGSTY2.32.119 18 17 16 15pg_flight_recorderpg_cron
RPMPIGSTY2.32.119 18 17 16 15pg_flight_recorder_$vpg_cron_$v
DEBPIGSTY2.32.119 18 17 16 15postgresql-$v-pg-flight-recorderpostgresql-$v-cron
Linux / PGPG19PG18PG17PG16PG15
el8.x86_64N/APIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1
el8.aarch64N/APIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1
el9.x86_64PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1
el9.aarch64PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1
el10.x86_64PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1
el10.aarch64PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1
d12.x86_64PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1
d12.aarch64PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1
d13.x86_64PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1
d13.aarch64PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1
u22.x86_64PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1
u22.aarch64PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1
u24.x86_64PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1
u24.aarch64PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1
u26.x86_64PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1
u26.aarch64PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1PIGSTY 2.32.1
PackageVersionOSORGSIZEFile URL
pg_flight_recorder_192.32.1el9.x86_64pigsty98.4 KiBpg_flight_recorder_19-2.32.1-1PGSTY.el9.noarch.rpm
pg_flight_recorder_192.32.1el9.aarch64pigsty98.4 KiBpg_flight_recorder_19-2.32.1-1PGSTY.el9.noarch.rpm
pg_flight_recorder_192.32.1el10.x86_64pigsty98.6 KiBpg_flight_recorder_19-2.32.1-1PGSTY.el10.noarch.rpm
pg_flight_recorder_192.32.1el10.aarch64pigsty98.6 KiBpg_flight_recorder_19-2.32.1-1PGSTY.el10.noarch.rpm
postgresql-19-pg-flight-recorder2.32.1d12.x86_64pigsty92.2 KiBpostgresql-19-pg-flight-recorder_2.32.1-1PGSTY~bookworm_all.deb
postgresql-19-pg-flight-recorder2.32.1d12.aarch64pigsty92.2 KiBpostgresql-19-pg-flight-recorder_2.32.1-1PGSTY~bookworm_all.deb
postgresql-19-pg-flight-recorder2.32.1d13.x86_64pigsty92.1 KiBpostgresql-19-pg-flight-recorder_2.32.1-1PGSTY~trixie_all.deb
postgresql-19-pg-flight-recorder2.32.1d13.aarch64pigsty92.1 KiBpostgresql-19-pg-flight-recorder_2.32.1-1PGSTY~trixie_all.deb
postgresql-19-pg-flight-recorder2.32.1u22.x86_64pigsty94.1 KiBpostgresql-19-pg-flight-recorder_2.32.1-1PGSTY~jammy_all.deb
postgresql-19-pg-flight-recorder2.32.1u22.aarch64pigsty94.1 KiBpostgresql-19-pg-flight-recorder_2.32.1-1PGSTY~jammy_all.deb
postgresql-19-pg-flight-recorder2.32.1u24.x86_64pigsty93.8 KiBpostgresql-19-pg-flight-recorder_2.32.1-1PGSTY~noble_all.deb
postgresql-19-pg-flight-recorder2.32.1u24.aarch64pigsty93.8 KiBpostgresql-19-pg-flight-recorder_2.32.1-1PGSTY~noble_all.deb
postgresql-19-pg-flight-recorder2.32.1u26.x86_64pigsty93.8 KiBpostgresql-19-pg-flight-recorder_2.32.1-1PGSTY~resolute_all.deb
postgresql-19-pg-flight-recorder2.32.1u26.aarch64pigsty93.8 KiBpostgresql-19-pg-flight-recorder_2.32.1-1PGSTY~resolute_all.deb
PackageVersionOSORGSIZEFile URL
pg_flight_recorder_182.32.1el8.x86_64pigsty104.5 KiBpg_flight_recorder_18-2.32.1-1PGSTY.el8.noarch.rpm
pg_flight_recorder_182.32.1el8.aarch64pigsty104.5 KiBpg_flight_recorder_18-2.32.1-1PGSTY.el8.noarch.rpm
pg_flight_recorder_182.32.1el9.x86_64pigsty98.4 KiBpg_flight_recorder_18-2.32.1-1PGSTY.el9.noarch.rpm
pg_flight_recorder_182.32.1el9.aarch64pigsty98.4 KiBpg_flight_recorder_18-2.32.1-1PGSTY.el9.noarch.rpm
pg_flight_recorder_182.32.1el10.x86_64pigsty98.6 KiBpg_flight_recorder_18-2.32.1-1PGSTY.el10.noarch.rpm
pg_flight_recorder_182.32.1el10.aarch64pigsty98.6 KiBpg_flight_recorder_18-2.32.1-1PGSTY.el10.noarch.rpm
postgresql-18-pg-flight-recorder2.32.1d12.x86_64pigsty92.2 KiBpostgresql-18-pg-flight-recorder_2.32.1-1PGSTY~bookworm_all.deb
postgresql-18-pg-flight-recorder2.32.1d12.aarch64pigsty92.2 KiBpostgresql-18-pg-flight-recorder_2.32.1-1PGSTY~bookworm_all.deb
postgresql-18-pg-flight-recorder2.32.1d13.x86_64pigsty92.2 KiBpostgresql-18-pg-flight-recorder_2.32.1-1PGSTY~trixie_all.deb
postgresql-18-pg-flight-recorder2.32.1d13.aarch64pigsty92.2 KiBpostgresql-18-pg-flight-recorder_2.32.1-1PGSTY~trixie_all.deb
postgresql-18-pg-flight-recorder2.32.1u22.x86_64pigsty94.1 KiBpostgresql-18-pg-flight-recorder_2.32.1-1PGSTY~jammy_all.deb
postgresql-18-pg-flight-recorder2.32.1u22.aarch64pigsty94.1 KiBpostgresql-18-pg-flight-recorder_2.32.1-1PGSTY~jammy_all.deb
postgresql-18-pg-flight-recorder2.32.1u24.x86_64pigsty93.7 KiBpostgresql-18-pg-flight-recorder_2.32.1-1PGSTY~noble_all.deb
postgresql-18-pg-flight-recorder2.32.1u24.aarch64pigsty93.7 KiBpostgresql-18-pg-flight-recorder_2.32.1-1PGSTY~noble_all.deb
postgresql-18-pg-flight-recorder2.32.1u26.x86_64pigsty93.8 KiBpostgresql-18-pg-flight-recorder_2.32.1-1PGSTY~resolute_all.deb
postgresql-18-pg-flight-recorder2.32.1u26.aarch64pigsty93.8 KiBpostgresql-18-pg-flight-recorder_2.32.1-1PGSTY~resolute_all.deb
PackageVersionOSORGSIZEFile URL
pg_flight_recorder_172.32.1el8.x86_64pigsty104.5 KiBpg_flight_recorder_17-2.32.1-1PGSTY.el8.noarch.rpm
pg_flight_recorder_172.32.1el8.aarch64pigsty104.5 KiBpg_flight_recorder_17-2.32.1-1PGSTY.el8.noarch.rpm
pg_flight_recorder_172.32.1el9.x86_64pigsty98.4 KiBpg_flight_recorder_17-2.32.1-1PGSTY.el9.noarch.rpm
pg_flight_recorder_172.32.1el9.aarch64pigsty98.4 KiBpg_flight_recorder_17-2.32.1-1PGSTY.el9.noarch.rpm
pg_flight_recorder_172.32.1el10.x86_64pigsty98.6 KiBpg_flight_recorder_17-2.32.1-1PGSTY.el10.noarch.rpm
pg_flight_recorder_172.32.1el10.aarch64pigsty98.6 KiBpg_flight_recorder_17-2.32.1-1PGSTY.el10.noarch.rpm
postgresql-17-pg-flight-recorder2.32.1d12.x86_64pigsty92.2 KiBpostgresql-17-pg-flight-recorder_2.32.1-1PGSTY~bookworm_all.deb
postgresql-17-pg-flight-recorder2.32.1d12.aarch64pigsty92.2 KiBpostgresql-17-pg-flight-recorder_2.32.1-1PGSTY~bookworm_all.deb
postgresql-17-pg-flight-recorder2.32.1d13.x86_64pigsty92.1 KiBpostgresql-17-pg-flight-recorder_2.32.1-1PGSTY~trixie_all.deb
postgresql-17-pg-flight-recorder2.32.1d13.aarch64pigsty92.1 KiBpostgresql-17-pg-flight-recorder_2.32.1-1PGSTY~trixie_all.deb
postgresql-17-pg-flight-recorder2.32.1u22.x86_64pigsty94.1 KiBpostgresql-17-pg-flight-recorder_2.32.1-1PGSTY~jammy_all.deb
postgresql-17-pg-flight-recorder2.32.1u22.aarch64pigsty94.1 KiBpostgresql-17-pg-flight-recorder_2.32.1-1PGSTY~jammy_all.deb
postgresql-17-pg-flight-recorder2.32.1u24.x86_64pigsty93.7 KiBpostgresql-17-pg-flight-recorder_2.32.1-1PGSTY~noble_all.deb
postgresql-17-pg-flight-recorder2.32.1u24.aarch64pigsty93.7 KiBpostgresql-17-pg-flight-recorder_2.32.1-1PGSTY~noble_all.deb
postgresql-17-pg-flight-recorder2.32.1u26.x86_64pigsty93.8 KiBpostgresql-17-pg-flight-recorder_2.32.1-1PGSTY~resolute_all.deb
postgresql-17-pg-flight-recorder2.32.1u26.aarch64pigsty93.8 KiBpostgresql-17-pg-flight-recorder_2.32.1-1PGSTY~resolute_all.deb
PackageVersionOSORGSIZEFile URL
pg_flight_recorder_162.32.1el8.x86_64pigsty104.5 KiBpg_flight_recorder_16-2.32.1-1PGSTY.el8.noarch.rpm
pg_flight_recorder_162.32.1el8.aarch64pigsty104.5 KiBpg_flight_recorder_16-2.32.1-1PGSTY.el8.noarch.rpm
pg_flight_recorder_162.32.1el9.x86_64pigsty98.4 KiBpg_flight_recorder_16-2.32.1-1PGSTY.el9.noarch.rpm
pg_flight_recorder_162.32.1el9.aarch64pigsty98.4 KiBpg_flight_recorder_16-2.32.1-1PGSTY.el9.noarch.rpm
pg_flight_recorder_162.32.1el10.x86_64pigsty98.6 KiBpg_flight_recorder_16-2.32.1-1PGSTY.el10.noarch.rpm
pg_flight_recorder_162.32.1el10.aarch64pigsty98.6 KiBpg_flight_recorder_16-2.32.1-1PGSTY.el10.noarch.rpm
postgresql-16-pg-flight-recorder2.32.1d12.x86_64pigsty92.2 KiBpostgresql-16-pg-flight-recorder_2.32.1-1PGSTY~bookworm_all.deb
postgresql-16-pg-flight-recorder2.32.1d12.aarch64pigsty92.2 KiBpostgresql-16-pg-flight-recorder_2.32.1-1PGSTY~bookworm_all.deb
postgresql-16-pg-flight-recorder2.32.1d13.x86_64pigsty92.1 KiBpostgresql-16-pg-flight-recorder_2.32.1-1PGSTY~trixie_all.deb
postgresql-16-pg-flight-recorder2.32.1d13.aarch64pigsty92.1 KiBpostgresql-16-pg-flight-recorder_2.32.1-1PGSTY~trixie_all.deb
postgresql-16-pg-flight-recorder2.32.1u22.x86_64pigsty94.1 KiBpostgresql-16-pg-flight-recorder_2.32.1-1PGSTY~jammy_all.deb
postgresql-16-pg-flight-recorder2.32.1u22.aarch64pigsty94.1 KiBpostgresql-16-pg-flight-recorder_2.32.1-1PGSTY~jammy_all.deb
postgresql-16-pg-flight-recorder2.32.1u24.x86_64pigsty93.7 KiBpostgresql-16-pg-flight-recorder_2.32.1-1PGSTY~noble_all.deb
postgresql-16-pg-flight-recorder2.32.1u24.aarch64pigsty93.7 KiBpostgresql-16-pg-flight-recorder_2.32.1-1PGSTY~noble_all.deb
postgresql-16-pg-flight-recorder2.32.1u26.x86_64pigsty93.8 KiBpostgresql-16-pg-flight-recorder_2.32.1-1PGSTY~resolute_all.deb
postgresql-16-pg-flight-recorder2.32.1u26.aarch64pigsty93.8 KiBpostgresql-16-pg-flight-recorder_2.32.1-1PGSTY~resolute_all.deb
PackageVersionOSORGSIZEFile URL
pg_flight_recorder_152.32.1el8.x86_64pigsty104.5 KiBpg_flight_recorder_15-2.32.1-1PGSTY.el8.noarch.rpm
pg_flight_recorder_152.32.1el8.aarch64pigsty104.5 KiBpg_flight_recorder_15-2.32.1-1PGSTY.el8.noarch.rpm
pg_flight_recorder_152.32.1el9.x86_64pigsty98.4 KiBpg_flight_recorder_15-2.32.1-1PGSTY.el9.noarch.rpm
pg_flight_recorder_152.32.1el9.aarch64pigsty98.4 KiBpg_flight_recorder_15-2.32.1-1PGSTY.el9.noarch.rpm
pg_flight_recorder_152.32.1el10.x86_64pigsty98.6 KiBpg_flight_recorder_15-2.32.1-1PGSTY.el10.noarch.rpm
pg_flight_recorder_152.32.1el10.aarch64pigsty98.6 KiBpg_flight_recorder_15-2.32.1-1PGSTY.el10.noarch.rpm
postgresql-15-pg-flight-recorder2.32.1d12.x86_64pigsty92.2 KiBpostgresql-15-pg-flight-recorder_2.32.1-1PGSTY~bookworm_all.deb
postgresql-15-pg-flight-recorder2.32.1d12.aarch64pigsty92.2 KiBpostgresql-15-pg-flight-recorder_2.32.1-1PGSTY~bookworm_all.deb
postgresql-15-pg-flight-recorder2.32.1d13.x86_64pigsty92.1 KiBpostgresql-15-pg-flight-recorder_2.32.1-1PGSTY~trixie_all.deb
postgresql-15-pg-flight-recorder2.32.1d13.aarch64pigsty92.1 KiBpostgresql-15-pg-flight-recorder_2.32.1-1PGSTY~trixie_all.deb
postgresql-15-pg-flight-recorder2.32.1u22.x86_64pigsty94.1 KiBpostgresql-15-pg-flight-recorder_2.32.1-1PGSTY~jammy_all.deb
postgresql-15-pg-flight-recorder2.32.1u22.aarch64pigsty94.1 KiBpostgresql-15-pg-flight-recorder_2.32.1-1PGSTY~jammy_all.deb
postgresql-15-pg-flight-recorder2.32.1u24.x86_64pigsty93.7 KiBpostgresql-15-pg-flight-recorder_2.32.1-1PGSTY~noble_all.deb
postgresql-15-pg-flight-recorder2.32.1u24.aarch64pigsty93.7 KiBpostgresql-15-pg-flight-recorder_2.32.1-1PGSTY~noble_all.deb
postgresql-15-pg-flight-recorder2.32.1u26.x86_64pigsty93.8 KiBpostgresql-15-pg-flight-recorder_2.32.1-1PGSTY~resolute_all.deb
postgresql-15-pg-flight-recorder2.32.1u26.aarch64pigsty93.8 KiBpostgresql-15-pg-flight-recorder_2.32.1-1PGSTY~resolute_all.deb

Source

github.com/neptunestation-com/pg_flight_recorder

pig build pkg pg_flight_recorder;		# build rpm/deb

Install

Make sure PGDG and PIGSTY repo available:

pig repo add pgsql -u   # add both repo and update cache

Install this extension with pig:

pig install pg_flight_recorder;		# install by package name
pig install pgfr_record;		# install by extension name

pig install pgfr_record -v 19;   # install for PG 19
pig install pgfr_record -v 18;   # install for PG 18
pig install pgfr_record -v 17;   # install for PG 17
pig install pgfr_record -v 16;   # install for PG 16
pig install pgfr_record -v 15;   # install for PG 15

Create this extension with:

CREATE EXTENSION pgfr_record CASCADE; -- requires pg_cron

Usage

Sources:

pgfr_record is the collection half of PostgreSQL Flight Recorder. It periodically samples PostgreSQL activity, waits, locks, replication, vacuum, and related health data into bounded in-database buffers, then retains snapshots for incident analysis. Use it when short-lived database conditions must survive long enough for later diagnosis.

Install and Enable Recording

pgfr_record requires pg_cron:

CREATE EXTENSION pg_cron;
CREATE EXTENSION pgfr_record;
SELECT pgfr_record.enable();

enable() installs and schedules the collector jobs. It also reports configuration warnings; review them rather than treating a successful call as proof that every metric is being collected.

Inspect Recorder Health

SELECT * FROM pgfr_record.health_check();
SELECT * FROM pgfr_record.ring_buffer_health();
SELECT * FROM pgfr_record.list_profiles();

Use set_mode or apply_profile to select the intended collection profile before an incident:

SELECT pgfr_record.set_mode('normal');

The available collection modes are normal, light, emergency, and kill. Profile names and sampling intervals can evolve, so list the installed profiles rather than hard-coding an undocumented name.

Recorded Data Index

  • deltas: interval changes for cumulative PostgreSQL counters.
  • recent_activity and recent_waits: sampled sessions and wait events.
  • recent_locks and recent_idle: lock and idle-session observations.
  • recent_replication and recent_vacuum: replication and maintenance state.
  • archiver_status: WAL archive health.
  • snapshot and ring-buffer tables: retained history used by pgfr_analyze.

Many working buffers are UNLOGGED to reduce write amplification. They are not crash-durable and are not replicated like ordinary logged tables; durable snapshots provide the longer-lived analysis surface.

Administration Functions

  • pgfr_record.enable(): create or activate scheduled collectors.
  • pgfr_record.disable(): stop scheduled collection.
  • pgfr_record.health_check(): report collector and configuration health.
  • pgfr_record.set_mode(…): change collection mode.
  • pgfr_record.apply_profile(…): apply a predefined profile.
  • pgfr_record.list_profiles(): enumerate available profiles.
  • pgfr_record.ring_buffer_health(): inspect capacity and retention pressure.
  • pgfr_record.cleanup(…): remove retained history according to the API.

Retention and Overhead

The default design keeps short ring-buffer history and longer durable snapshots, commonly around 7 and 30 days depending on the installed profile. Verify actual table sizes, job schedules, and retention settings in the installed version.

The recorder creates roughly ten pg_cron jobs. pg_cron.log_run can generate thousands of rows per day; disable that logging or purge cron history when the extra audit trail is unnecessary. Sampling also adds SQL, storage, and catalog traffic, so measure overhead on the target workload.

Version 2.29.2 handles managed-service roles that cannot UPDATE cron.job: jobs can still be scheduled, while the optional nodename normalization is skipped with a warning.

Caveats

  • pg_stat_statements enriches several analyses but is optional; enable and size it separately when needed.
  • Collection cannot reconstruct time periods that were never sampled. Enable and validate the recorder before an incident.
  • UNLOGGED buffers can be truncated after crash recovery.
  • Recorder tables can contain query text, role names, client data, and operational details. Apply appropriate privileges and retention controls.

Table reader