A PostgreSQL primary's pg_wal is growing while one physical standby and one logical subscriber are behind. Show how you prove which replication slot is retaining WAL, distinguish a slow or stopped consumer from an orphan, decide whether the consumer can catch up, and recover safely without deleting WAL files.
The dangerous version of this incident is the one where somebody frees disk space, because deleting write-ahead log files by hand destroys the ability to recover and to catch consumers up. Interviewers ask it to find out whether you treat growing storage as a disk problem or as a retention problem with a named owner. Two fields are routinely confused, and getting them the right way round is most of the technical signal: one describes how far the consumer has processed, the other describes how far back the primary must still keep log for it. The judgement half is deciding whether a consumer can realistically catch up or has to be rebuilt. This page covers the proof and that decision.
What the interviewer is scoring
Weak answer: deletes files from the WAL directory, drops an inactive slot without identifying its consumer, confuses consumer progress with the retention boundary, or promises that every lagging consumer can catch up.
In short: Start with consumer progress and slot retention state, not disk cleanup. Correlate replication or subscriber apply progress with the retention boundary, the slot's status and remaining safe headroom, and the configured cap; an inactive slot is not automatically orphaned.
The spoken answer and the reasoning behind it
- The full 90-second answer, written first person, the way you would actually say it
- How I reason through it: the mechanism, the decision points, and where the claim stops
- Verification steps with a written summary of what a controlled lab run showed, labelled as a summary rather than a transcript.
- Worked responses to the 3 follow-up probes listed above, plus the traps that lose the point
Card required. Cancel before day 7 and you are not charged.
How to reason through it
- Identify every slot's type, intended consumer, ownership, and lifecycle.
- Capture each slot's type, activity, restart position, confirmed flush position, status, and remaining safe headroom.
- For a physical consumer, correlate with the replication view's sent, written, flushed and replayed positions.
- Quantify retained WAL as the distance from the current write position back to the slot's restart position; that restart position is the retention boundary.
- Treat an inactive slot as one observation only; an orphan needs stronger proof than a disconnected consumer.
- Decide catch-up versus reseed from the generation rate against the apply rate, and the configured retention cap.
- Repair the owned consumer first. Never delete files under the WAL directory.
What I would verify
- Read the retention boundary and the consumer's progress as two separate numbers, and say which is which.
- Measure WAL generation rate against the consumer's apply rate before promising catch-up.
- Check the slot's status field for whether required log has already been lost.
- Identify the consumer behind an inactive slot before considering dropping it.
- Confirm the retention cap, because it decides whether the primary will protect itself or fill the disk.
Follow-ups they push on
- A slot shows inactive. Can you drop it?
- How do you decide catch-up versus reseed?
- The disk is nearly full right now. What is the emergency action?
The probes are open. Pro carries the spoken answer, the reasoning behind it, and the verification steps, including a worked response to each of these.
Concepts tested
Learn it, run it, then say it
Three steps, in order. Nothing here is a detour.
1 · Learn the mechanism
Understand it before you try to say it.
2 · Practise it for real
Run it once so the answer describes something you have seen.
3 · Rehearse the next question
Keep going while the mechanism is fresh.
Questions that go with this one
- staff · ProPatroni leadership loss during a DCS partition: prove one writer.The cluster event that frequently creates the abandoned slot in the first place.
- staff · ProYou must cut a write workload from PostgreSQL 14 to 18 with logical replication. Where is the rollback boundary, and how do you prove the subscriber caught the source stop LSN?Logical slots again, this time as the mechanism a migration depends on.