Reputation: 31545
Is there a way to measure logical replication lag in PostgreSQL?
Upvotes: 5
Views: 5689
Reputation: 31545
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.
Upvotes: 11