pg_stat_recovery — PostgreSQL statistics view

The PostgreSQL pg_stat_recovery statistics view: full column reference (names, types, descriptions), catalog relationships and version support.

Summary

The pg_stat_recovery view will contain only one row, showing statistics about the recovery state of the startup process. This view returns no row when the server is not in recovery.

(Description quoted from the official PostgreSQL documentation.)

Columns

The pg_stat_recovery statistics view exposes the following columns (names, types and descriptions are taken verbatim from the PostgreSQL documentation):

  • promote_triggered boolean
    True if a promotion has been triggered.
  • last_replayed_read_lsn pg_lsn
    Start write-ahead log location of the last successfully replayed WAL tuple/">record.
  • last_replayed_end_lsn pg_lsn
    End write-ahead log location of the last successfully replayed WAL record.
  • last_replayed_tli integer
    Timeline of the last successfully replayed WAL record.
  • replay_end_lsn pg_lsn
    Write-ahead log location of the record currently being replayed (end position plus one). When no record is being actively replayed, equals last_replayed_end_lsn.
  • replay_end_tli integer
    Timeline of the WAL record currently being replayed.
  • recovery_last_xact_time timestamp with time zone
    Timestamp of the last transaction commit or abort replayed during recovery. This is the time at which the commit or abort WAL record for that transaction was generated on the primary.
  • current_chunk_start_time timestamp with time zone
    Time when the startup process observed that replay had caught up with the latest received WAL chunk. Used in recovery-conflict timing and replay/apply-lag diagnostics. NULL if not yet available.
  • pause_state text
    Recovery pause state. Possible values are: not paused: Recovery is proceeding normally. pause requested: A pause has been requested but recovery has not yet paused. paused: Recovery is paused.

Version applicability

Present in PostgreSQL 19 (verified against each release’s documentation). This object was introduced in PostgreSQL 19.

Related & references

Reference: PostgreSQL documentation — pg_stat_recovery.