denrepo

PostgreSQLReplication

Replication lag (run on the primary)

Each connected standby with how far behind it is, in bytes and in time.

Not yet verified. How scripts are tested

b-pg-repl.sql
1SELECT client_addr, application_name, state, sync_state,2       pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), replay_lsn)) AS replay_lag_size,3       write_lag, flush_lag, replay_lag4FROM pg_stat_replication;

Paste it into your query tool.

Open in denrepo