Technologies/PostgreSQL/postgresql.replication.flush_lag
PostgreSQLPostgreSQLMetric

postgresql.replication.flush_lag

Replication flush lag
Dimensions:None
Available on:Native (1)DatadogDatadog (1)
Interface Metrics (2)
Native
flush_lag statistic from pg_stat_replication
Dimensions:None
DatadogDatadog
Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written and flushed it (but not yet applied it). This can be used to gauge the delay that synchronous_commit level on incurred while committing if this server was configured as a synchronous standby. Only available with postgresql 10 and newer.
Dimensions:None

Technical Annotations (16)

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 (12)
WALcomponentpostgres_exportercomponentpgwatchcomponentpg_stat_replicationcomponentWAL applicationconceptfailoverconceptstreaming replicationconceptWAL sendercomponentreplication slotcomponentWAL replayconceptreplication lagconceptclustering architecturesconcept
Related Insights (6)
Replication lag causes replica data staleness and read inconsistencieswarning
Replication lag triggered by CPU saturation from bad query planscritical
Replication lag causes stale replica datacritical
Missing data on UPDATE/DELETE operations silently skipped in logical replicationwarning
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.

Replication lag threatens high availability and data consistencywarning