PostgreSQL Replication Lag — Distance between current and last confirmed flushed

Quick SQL command to report the delta between the current and confirmed flushed LSN’s:

SELECT slot_name, confirmed_flush_lsn, pg_current_wal_lsn(), (pg_current_wal_lsn() - confirmed_flush_lsn) AS lsn_distance
FROM pg_replication_slots
ORDER BY slot_name;

 

Leave a Reply

Your email address will not be published. Required fields are marked *