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
- OSUbuntu 26.04 LTS (resolute)
- PostgreSQL18.6-0ubuntu0.26.04.1
- ReplicationPhysical streaming, async, with slots
- TimeAbout 15 min
- Reviewed27 August 2026
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.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| db-a01 | 192.168.0.81 | Ubuntu 26.04 LTS | Primary / Source / Replica Set Member 1 | 2 Core | 4 GB | 50 GB |
| db-c01 | 192.168.0.83 | Ubuntu 26.04 LTS | Replica Set Member 3 / Cascading and Delayed Replica | 2 Core | 4 GB | 50 GB |
Before you start
- A streaming standby.
-
Look from the primary
-
Look from the standby
-
Read the settings the standby is using
-
Measure lag under load