CONCEPT SHEET · Concepts
ACID vs BASE
One-liner: ACID is the transactional guarantee set of relational DBs; BASE is the availability-first posture of distributed NoSQL stores.
ArticleConcepts© Arthur Bernier Jr473 words1 code block
Say this#
How it works#
ACID (Postgres, MySQL, Oracle, Spanner):
- BEGIN; writes go to WAL + buffer pool.
- Locks or MVCC snapshots give isolation.
- COMMIT fsyncs the WAL record → durable. Crash recovery replays WAL.
BASE (Cassandra, DynamoDB, Riak, early Mongo):
- Write accepted by any available replica (tunable W).
- Replicated asynchronously / via gossip; hinted handoff for down nodes.
- Conflicts resolved by last-write-wins, vector clocks, or CRDTs; read repair fixes stragglers.
TEXT
ACID: client -> single leader -> WAL -> commit -> ackBASE: client -> any node -> ack -> async replicate -> converge
Trade-offs#
| Choice | Pro | Con |
|---|
| ACID single-node | Simple reasoning, joins, constraints | Vertical scale ceiling, single point for writes |
| ACID distributed (Spanner, CockroachDB) | Strong guarantees at scale | Cross-region commit latency (2PC + consensus), cost |
| BASE | Horizontal scale, always-writable, partition-tolerant | App must handle stale reads and conflicts |
| Serializable isolation | No anomalies | Lower throughput, more aborts/retries |
| Read Committed (Postgres default) | Fast, few aborts | Non-repeatable reads, phantoms possible |
Numbers#
- Postgres default isolation: Read Committed. MySQL InnoDB default: Repeatable Read.
- Single Postgres node: order of thousands to low tens of thousands of writes/s depending on fsync and row size.
- Cross-region 2PC commit adds at least one WAN round trip (~50-150 ms).
- Serializable in Postgres is SSI (serializable snapshot isolation), not 2PL.
In the interview#