'PostgreSQL — measure logical replication lag
Is there a way to measure logical replication lag in PostgreSQL?
Solution 1:[1]
You can check pg_catalog.pg_replication_slots. Run this code on the master (publisher) server:
SELECT
slot_name,
confirmed_flush_lsn,
pg_current_wal_lsn(),
(pg_current_wal_lsn() - confirmed_flush_lsn) AS lsn_distance
FROM pg_replication_slots;
lsn_distance is the measure of the replication lag.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Max Malysh |
