SQL vs NoSQL
| Relational (Postgres, MySQL) | Key-value / wide-column (DynamoDB, Cassandra) | Document (MongoDB) | |
|---|---|---|---|
| Model | Tables, joins, schema | Key → value; partition key + sort key | JSON documents |
| Strength | Transactions, flexible queries | Massive horizontal scale, predictable latency | Flexible nested data |
| Weakness | Harder to shard | Must design around access patterns; few joins | Joins/transactions weaker |
| Pick when | Default. Relationships, money, unknown queries | Huge write volume, simple lookups by key | Self-contained records |
Default to SQL unless you can name the scale or access pattern it can't handle. 'NoSQL because it scales' is not a reason by itself.
Also know: object storage (S3) for blobs, search index (Elasticsearch) for full-text, time-series DBs for metrics. Real systems use several — polyglot persistence.