Calculates on this device. File exports run online.
Database Replication Lag Calculator
See how far a replica is behind and why: the bytes a PostgreSQL standby is behind from two WAL locations or from pg_stat_replication, what SHOW REPLICA STATUS says about a MySQL replica, how long a replica needs to catch up from a backlog, and, from a log of lag samples, the 95th and 99th percentiles and every spike above your threshold.
Enter your values
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Fill in the values, then choose the button below them.
Your result
How it was worked out
How to use it
- PostgreSQL: run SELECT pg_current_wal_lsn(); on the primary and SELECT pg_last_wal_replay_lsn(); on the standby, or paste SELECT * FROM pg_stat_replication; after \x.
- MySQL: paste the output of SHOW REPLICA STATUS\G from the replica.
- Lag samples: paste or open a CSV with a lag column (and time and replica columns), set the threshold and press Find the spikes.
How it is worked out
- A WAL location X/Y is the byte position X × 2^32 + Y in hexadecimal; the bytes behind are the difference (as pg_wal_lsn_diff).
- Catch-up time = backlog ÷ (apply rate − write rate); if the replica applies no faster than the primary writes, it never catches up.
- Percentiles are nearest-rank: the 95th percentile is the value at rank ⌈0.95 × n⌉ of the sorted samples. A spike is a run of consecutive samples above the threshold.