Find lag in streaming replication
-- Find lag in bytes( run on standby)
postgresql configurationintermediate
by PostgreSQL
15 views
-- Find lag in bytes( run on standby)
1234567
postgres#
SELECT pg_wal_lsn_diff(sent_lsn, replay_lsn) from pg_stat_replication;
postgres#
SELECT CASE WHEN pg_last_wal_receive_lsn() =
pg_last_wal_replay_lsn()
THEN 0 ELSE
EXTRACT (EPOCH FROM now() - pg_last_xact_replay_timestamp()) END AS lag_seconds;Please to add comments
No comments yet. Be the first to comment!