til
til copied to clipboard
The Insatiable Postgres Replication Slot
SELECT
slot_name,
pg_size_pretty(
pg_wal_lsn_diff(
pg_current_wal_lsn(), restart_lsn)) AS retained_wal,
active,
restart_lsn FROM pg_replication_slots WHERE slot_name LIKE 'gh_%';
slot_name | retained_wal | active | restart_lsn
----------------------------+--------------+--------+---------------
gh_v2_xxx_yyy_zz | 18 MB | t | 12C2/7935C538
gh_v2_aaa_bbb_ccc | 20 MB | t | 12C2/790DDCE8
gh_v2_qqq_www_rrr | 16 MB | t | 12C2/794C8108
(3 rows)
https://www.morling.dev/blog/insatiable-postgres-replication-slot/