Created
August 22, 2025 22:04
-
-
Save akramarev/1effcb732c1537c5b6b7fc50808cf5a4 to your computer and use it in GitHub Desktop.
[Subscription replication slot lag in Postgres]
This file contains hidden or 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, | |
| plugin, | |
| slot_type, | |
| active, | |
| restart_lsn, | |
| confirmed_flush_lsn, | |
| pg_wal_lsn_diff(pg_current_wal_lsn(), confirmed_flush_lsn) as lag_size_raw, | |
| pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), confirmed_flush_lsn)) AS lag_size, | |
| age(xmin) AS xmin_age | |
| FROM pg_replication_slots | |
| -- WHERE pg_wal_lsn_diff(pg_current_wal_lsn(), confirmed_flush_lsn) > 3010425240 | |
| -- WHERE active = false | |
| ORDER BY pg_wal_lsn_diff(pg_current_wal_lsn(), confirmed_flush_lsn) desc; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment