NoSQL · Data models beyond tables
What does the CAP theorem actually say?
Short answer
During a network partition a distributed system can preserve consistency or availability, not both. Partition tolerance is not optional in a real distributed system, so the practical choice is CP versus AP behaviour.
Consistency in CAP means linearizability: every read sees the most recent completed write. Availability means every request to a non-failed node receives a non-error response. Partition tolerance means the system keeps operating despite dropped messages between nodes.
Networks partition. If a node cannot reach its peers, it must either reject some requests to avoid returning stale data, or answer with possibly stale data. That is the real decision. A system can be consistent and available when the network is healthy, which is why CAP alone is a coarse tool.
CP and AP in practice
- CP during a partition: minority replicas refuse writes, so clients see errors or higher latency instead of divergence
- AP during a partition: replicas keep accepting writes locally and reconcile later, so reads may be stale
- Leader-based systems are usually CP for writes; leaderless quorum systems can be tuned toward either side
- CAP says nothing about latency when the network is healthy, which is often the more important trade-off
Healthy network: C and A can both hold
Partition: choose C or A for the affected operations
PACELC: if Partition, trade A vs C
else trade Latency vs CPACELC extends the idea: when there is no partition, the trade-off is latency versus consistency. A quorum read that waits for a slow replica is choosing consistency over latency, even though no partition exists.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1What is the difference between CAP consistency and ACID consistency?
- 2How does PACELC refine CAP?
- 3Can a system be CP for writes and AP for reads?
- 4Why is partition tolerance not really optional?
Say it in the interview
CAP says that when a network partition happens, a distributed system has to choose between consistency and availability for the affected operations. Partition tolerance is unavoidable in a real deployment, so the meaningful choice is whether a minority replica rejects requests or serves possibly stale data. I also bring up PACELC, because when the network is healthy the trade-off becomes latency versus consistency. I would describe the behaviour per operation rather than label the whole database.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live NoSQL mock interview and get scored feedback on depth, clarity and confidence.