Skip to content
pgfr_record

pgfr_record

pg_flight_recorder : Server-side PostgreSQL performance flight recorder

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
6060
pgfr_record
pg_flight_recorder
2.29.2
STAT
Apache-2.0
SQL
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
----d--
No
No
No
Yes
no
no
Relationships
Schemaspgfr_record
Requires
pg_cron
Need By
pgfr_analyze
See Also
pg_stat_statements
pg_cron
pg_profile
pgmonitor
Siblings
pgfr_analyze

Package normalizes the upstream 0.0.0 control version to 2.29.2; run SELECT pgfr_record.enable() after CREATE EXTENSION. The downstream install patch defers scheduling until the CREATE transaction commits and guards optional pg_stat_statements.

Packages

TypeRepoVersionPG Major CompatibilityPackage PatternDependencies
EXT
PIGSTY
2.29.2
18
17
16
15
14
pg_flight_recorderpg_cron
RPM
PIGSTY
2.29.2
18
17
16
15
14
pg_flight_recorder_$vpg_cron_$v
DEB
PIGSTY
2.29.2
18
17
16
15
14
postgresql-$v-pg-flight-recorderpostgresql-$v-cron
Linux / PGPG18PG17PG16PG15PG14
el8.x86_64
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
MISS
el8.aarch64
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
MISS
el9.x86_64
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
MISS
el9.aarch64
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
MISS
el10.x86_64
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
MISS
el10.aarch64
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
MISS
d12.x86_64
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
MISS
d12.aarch64
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
MISS
d13.x86_64
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
MISS
d13.aarch64
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
MISS
u22.x86_64
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
MISS
u22.aarch64
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
MISS
u24.x86_64
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
MISS
u24.aarch64
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
MISS
u26.x86_64
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
MISS
u26.aarch64
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
PIGSTY 2.29.2
MISS
PackageVersionOSORGSIZEFile URL
pg_flight_recorder_182.29.2el8.x86_64pigsty92.0 KiBpg_flight_recorder_18-2.29.2-1PIGSTY.el8.noarch.rpm
pg_flight_recorder_182.29.2el8.aarch64pigsty92.0 KiBpg_flight_recorder_18-2.29.2-1PIGSTY.el8.noarch.rpm
pg_flight_recorder_182.29.2el9.x86_64pigsty86.4 KiBpg_flight_recorder_18-2.29.2-1PIGSTY.el9.noarch.rpm
pg_flight_recorder_182.29.2el9.aarch64pigsty86.3 KiBpg_flight_recorder_18-2.29.2-1PIGSTY.el9.noarch.rpm
pg_flight_recorder_182.29.2el10.x86_64pigsty86.6 KiBpg_flight_recorder_18-2.29.2-1PIGSTY.el10.noarch.rpm
pg_flight_recorder_182.29.2el10.aarch64pigsty86.5 KiBpg_flight_recorder_18-2.29.2-1PIGSTY.el10.noarch.rpm
postgresql-18-pg-flight-recorder2.29.2d12.x86_64pigsty79.2 KiBpostgresql-18-pg-flight-recorder_2.29.2-1PIGSTY~bookworm_all.deb
postgresql-18-pg-flight-recorder2.29.2d12.aarch64pigsty79.2 KiBpostgresql-18-pg-flight-recorder_2.29.2-1PIGSTY~bookworm_all.deb
postgresql-18-pg-flight-recorder2.29.2d13.x86_64pigsty79.2 KiBpostgresql-18-pg-flight-recorder_2.29.2-1PIGSTY~trixie_all.deb
postgresql-18-pg-flight-recorder2.29.2d13.aarch64pigsty79.2 KiBpostgresql-18-pg-flight-recorder_2.29.2-1PIGSTY~trixie_all.deb
postgresql-18-pg-flight-recorder2.29.2u22.x86_64pigsty81.0 KiBpostgresql-18-pg-flight-recorder_2.29.2-1PIGSTY~jammy_all.deb
postgresql-18-pg-flight-recorder2.29.2u22.aarch64pigsty81.0 KiBpostgresql-18-pg-flight-recorder_2.29.2-1PIGSTY~jammy_all.deb
postgresql-18-pg-flight-recorder2.29.2u24.x86_64pigsty80.7 KiBpostgresql-18-pg-flight-recorder_2.29.2-1PIGSTY~noble_all.deb
postgresql-18-pg-flight-recorder2.29.2u24.aarch64pigsty80.7 KiBpostgresql-18-pg-flight-recorder_2.29.2-1PIGSTY~noble_all.deb
postgresql-18-pg-flight-recorder2.29.2u26.x86_64pigsty80.7 KiBpostgresql-18-pg-flight-recorder_2.29.2-1PIGSTY~resolute_all.deb
postgresql-18-pg-flight-recorder2.29.2u26.aarch64pigsty80.7 KiBpostgresql-18-pg-flight-recorder_2.29.2-1PIGSTY~resolute_all.deb

Source

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 via package name, for the active PG version
pig install pgfr_record;		# install by extension name, for the current active PG version

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.
Last updated on