Created
August 2, 2024 14:42
-
-
Save klaussilveira/554ca0feb7ac42663ac386f738fe8154 to your computer and use it in GitHub Desktop.
PostgreSQL: Find Lagged Replication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT slot_name, | |
pg_wal_lsn_diff( | |
pg_current_wal_lsn(), | |
restart_lsn | |
) AS bytes_behind, | |
active, | |
wal_status | |
FROM pg_replication_slots | |
WHERE wal_status <> 'lost' | |
ORDER BY restart_lsn; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment