Replication lag
Replication lag is a difference in replication progress between a source and a replica, measured at a named processing stage in a stated unit.
Separate byte backlog from measured delay and identify receipt, write, flush or replay. PostgreSQL 18 pg_stat_replication lag intervals describe recent processing and notification delays, not a catch-up-time estimate. An idle caught-up standby can report NULL; NULL can also indicate missing tracking information, so it must not be replaced unconditionally with zero. [1] Slot restart_lsn is a retention horizon, not replay progress; confirmed_flush_lsn describes logical-consumer receipt and is NULL for physical slots. [4]
After a history fork, a numerical LSN difference alone does not show that one replica can catch up to the other. Establish compatible timeline ancestry before interpreting the distance as backlog. [5]
Relations
- related
- Synchronous replication, Asynchronous replication, Log sequence number, Storage latency, Replication slot, PostgreSQL timeline
Citations
- PostgreSQL 18: pg_stat_replication and lag semantics
- PostgreSQL 18: pg_replication_slots state and progress fields
- PostgreSQL 18: Timelines