Explain CAP theorem with PostgreSQL versus a multi-region DynamoDB-style store.
PICTURE THIS: DATABASE INDEX
Simple meaning
On a network partition you cannot have both linearizable consistency and availability.
WHY — CAP instead of guessing?
Why interviewers care about CAP:
contrast on CAP, not two memorised paragraphs.
the developer, then one case where picking wrong hurts.
Name the idea, why it exists, then one short example.
End with when you use it and one common pitfall.
STEPS — What happens step by step?
Before you speak the answer, walk the interviewer through these steps:
- 1On a network partition
you cannot have both linearizable consistency and availability.
- 2A single-primary Postgres cluster
typically chooses consistency: the replica may refuse writes if it cannot reach the primary.
- 3A multi-region AP store
keeps accepting writes and reconciles later.
- 4Interviewers want you to
name the partition as the forcing function, not a vague CA system in the real world.
- 5Common mistake
What juniors usually get wrong.
- 6Close
When you pick this over the alternative.
EXAMPLE — See it in action
Here's a short line you can speak, broken into clear beats:
Note: Adapt this scaffold to your own project — keep it under 60–90 seconds.
Key takeaway
On a network partition you cannot have both linearizable consistency and availability. A single-primary Postgres cluster typically chooses consistency: the replica may refuse writes if it cannot reach the primary.