WAL & replicationintermediatePro runbook

Read replication lag as three numbers

pg_stat_replication reports write, flush and replay lag separately. A healthy standby showed 346, 356 and 427 microseconds, and which of the three grows during an incident tells you whether the problem is the network, the standby's disk, or replay itself.

Problem

What you're actually looking at

The symptom as it shows up on a real server.

Replication lag is usually reduced to a single number, which is why it so rarely leads anywhere. PostgreSQL exposes three, corresponding to three different journeys a WAL record makes: arriving at the standby, being made durable there, and being applied so queries can see it. Each has a different cause and a different fix, and collapsing them hides the answer.

Meridian's dashboard shows the replica lagging. Nobody can say whether the WAL has not arrived, has not been flushed, or has arrived and cannot be applied.

Simple terms

A change on the primary makes three separate journeys to reach a replica: it has to arrive, it has to be written down safely, and it has to be applied so queries can see it. PostgreSQL times all three. If only the first is slow, the network or the sender is the problem. If the second is slow, the replica's disk is. If the third is slow while the first two are fine, the data is already there and something on the replica is blocking it from being applied. One combined number would hide all of that.

ProCaptured evidence where the run produced it

Full runbook for this incident

The scenario above is free. What Pro unlocks is the fix: how to identify read replication lag as three numbers, the exact SQL to trace it, PostgreSQL 18 output for the steps we captured, the resolution path, and how to stop it recurring.
  • The full identify checklist, the exact signals that tell you it's this incident
  • Every diagnostic query; lab output is attached only to the steps we actually captured
  • The resolution path and the pitfalls that make it worse
  • Mitigation steps to stop it recurring, plus a verify-you're-done query

Card required. Cancel before day 7 and you are not charged.

Compare plans

Related runbooks

Continue the same incident path

Sibling procedures that cover the adjacent setup, recovery, or prevention step.

Connected

How this connects to the rest of the library

A live view of this page's real cross-references, what explains it, what fixes it, what to tune, and where to go next. Every link is an authored relationship, not a guess.

Open in the interactive map →
ShareLinkedInX

Need the full procedure?

Pro runbooks finish the incident path

Free runbooks teach the shape. Pro opens the full step transcript, edge cases, and prevention depth.

FollowSubstackLinkedInnew errors · lab notes · hiring loops