Designing Data-Intensive Applications: Summary and Review

Designing Data-Intensive Applications: The Big Ideas Behind Reliable, Scalable, and Maintainable Systems by Martin Kleppmann

Review
This is a great book for understanding databases and preparing for the systems design interview.
Summary
SQL vs. NoSQL (Documents)
SQL
- Joins are easy
- Transactions
- Normalized data/foreign keys
- Good for many-to-many, or many-to-one relationships. Also for one-to-many relationships
- Datastructures are non-local (requires lookup of foreign keys), but joins are easy
- Best for many-to-many data
- Migrations require downtime
Documents
- Joins are hard
- Eventual consistency
- Duplicated data/foreign fields
- Not good for many-to-many relationships, or many-to-one. Good for one-to-many relationships
- Better locality of datastructures
- Best for tree-like data
- Schemaless (schema on write), no downtime migrations, but you can have inconsistent schemas (slowly update schema as documents are read/written)
Databases
Denormalization is good only when reads heavily outnumber writes, like a 100:1 ratio.