Solidify your understanding of PostgreSQL logical decoding — replication slots, WAL senders, and change data capture patterns.
0 / 5 completed
1 / 5
A data engineer asks why the CDC pipeline missed rows. The root cause is that the replication slot wasn't created before the publisher started. What is a PostgreSQL replication slot?
A replication slot retains WAL segments until the consumer confirms receipt, preventing data loss. Without it, Postgres may recycle WAL before the subscriber reads it.
2 / 5
In a PR review, a colleague questions the choice of pgoutput vs decoderbufs as the logical decoding plugin. When would you prefer pgoutput?
pgoutput is built into Postgres 10+ and is the native protocol used by logical replication and Debezium's pgoutput decoder. decoderbufs requires a C extension and outputs Protobuf.
3 / 5
During a standup, a teammate says pg_recvlogical is printing duplicate rows after a restart. You explain this happens because:
Logical decoding is at-least-once. After a restart, the slot replays from the last confirmed LSN. Consumers must commit offsets (via feedback messages) and handle duplicates idempotently.
4 / 5
A DBA warns that an idle replication slot is causing disk to fill up. In a post-mortem, you note this happens because:
An idle replication slot prevents Postgres from recycling WAL segments the slot hasn't confirmed, causing WAL to grow unboundedly. Monitor pg_replication_slots.confirmed_flush_lsn.
5 / 5
Your team needs to stream changes from Postgres to a downstream service using WAL sender. A junior engineer asks what the WAL sender process does. The correct answer is:
The WAL sender is a Postgres background process that reads WAL and streams it to connected replication clients — physical standbys or logical consumers like pg_recvlogical or Debezium.