CertGrid CertGrid
Hands-on Lab·PostgreSQL

PostgreSQL Replication Monitoring

The primary and the standby each have their own view, and neither is complete. Four LSNs on the primary show exactly where a lagging standby is stuck - sent, written, flushed or replayed.

Replication Guide 28 of 47 Intermediate

Written against the versions above. Column names differ between the two views and between versions - `pg_stat_wal_receiver` has `received_tli`, not `received_lsn`. Check `\d` on the view rather than trusting a remembered query.

`pg_stat_replication` exists only on the primary; `pg_stat_wal_receiver` only on the standby.
Server NameIP AddressOSRolesCPURAMHDD
db-a01192.168.0.81Ubuntu 26.04 LTSPrimary / Source / Replica Set Member 12 Core4 GB50 GB
db-c01192.168.0.83Ubuntu 26.04 LTSReplica Set Member 3 / Cascading and Delayed Replica2 Core4 GB50 GB

Before you start

  1. Look from the primary

  2. Look from the standby

  3. Read the settings the standby is using

  4. Measure lag under load

Official sources