🗄️ Database Design / Normalization
Advanced
What is the CAP theorem?
Answer
The CAP theorem (Brewer, 2000) states that a distributed database can guarantee at most two of three properties simultaneously: Consistency (C) — every read returns the most recent write or an error; Availability (A) — every request receives a response (not necessarily the latest data); Partition Tolerance (P) — the system continues operating despite network partitions. Since network partitions are unavoidable in distributed systems, the real choice is between CP (consistent but may be unavailable during a partition — HBase, Zookeeper) and AP (available but may serve stale data — Cassandra, DynamoDB). Traditional RDBMS prioritize CP. Many systems allow tunable consistency per operation.