Technologies/PostgreSQL/replication_lag_seconds
PostgreSQLPostgreSQLMetric

replication_lag_seconds

Replication lag
Dimensions:None
Available on:PrometheusPrometheus (1)
Interface Metrics (1)
PrometheusPrometheus
Replication lag behind master in seconds
Dimensions:None

Technical Annotations (12)

Configuration Parameters (3)
max_wal_sendersrecommended: 10
maximum concurrent replication connections
max_replication_slotsrecommended: 10
maximum replication slots for lag tracking
wal_compressionrecommended: on
reduces WAL size and network transfer for replication
CLI Commands (1)
SELECT client_addr, state, sent_lsn, write_lsn, flush_lsn, replay_lsn, pg_wal_lsn_diff(sent_lsn, replay_lsn) AS replay_lag_bytes FROM pg_stat_replication;diagnostic
Technical References (8)
WALcomponentpostgres_exportercomponentpgwatchcomponentstreaming replicationconceptWAL sendercomponentreplication slotcomponentpg_stat_replicationcomponentWAL replayconcept
Related Insights (4)
CockroachDB Physical Replication Lag Threatening RPOwarning

Physical cluster replication lag (replication_lag) indicates the time gap between primary and standby clusters. Excessive lag means failover would result in data loss exceeding your Recovery Point Objective (RPO), threatening disaster recovery guarantees.

Replication lag causes replica data staleness and read inconsistencieswarning
Replication lag causes stale replica datacritical
Replication lag causes stale reads on replicaswarning

Streaming replication lag between primary and replica nodes increases, causing replicas to serve stale data. High lag indicates replica cannot keep up with primary write volume, network issues, or resource constraints on replica.