The families
| Family | Data shape | Superpower | Weak at | Examples |
|---|---|---|---|---|
| Relational (SQL) | Tables, rows, joins | Transactions, constraints, flexible queries | Horizontal write scaling (without effort) | PostgreSQL, MySQL |
| Key-value | key → blob | Extreme speed and scale for lookups by key | Queries by anything else | Redis, DynamoDB, Aerospike |
| Document | key → JSON document | Flexible schema, whole-object reads | Cross-document joins and transactions | MongoDB, Couchbase |
| Wide-column | partition key → sorted rows | Massive write throughput, time-ordered data | Ad-hoc queries, joins | Cassandra, ScyllaDB, HBase |
| Graph | Nodes + edges | Multi-hop relationship queries | Bulk analytics, sharding | Neo4j, Neptune |
| Search | Inverted index | Full-text search, relevance, facets | Being a source of truth | Elasticsearch, OpenSearch |
| Time-series | (series, time) → value | Compression, downsampling, range queries | General workloads | Prometheus, TimescaleDB, InfluxDB |
| Columnar / OLAP | Columns of a huge table | Analytical scans over billions of rows | Point updates, OLTP | ClickHouse, BigQuery, Snowflake |
| NewSQL | SQL, distributed | SQL + transactions + horizontal scale | Latency of consensus, cost | Spanner, CockroachDB, TiDB, YugabyteDB |
A decision guide
- Need multi-row transactions, constraints, or ad-hoc queries, at up to a few TB? → PostgreSQL/MySQL. This is the right default far more often than people admit.
- Simple get/put by key at huge scale with predictable latency? → Key-value (DynamoDB, Redis for in-memory).
- Very high write rate, append-mostly, read by partition + time range? → Wide-column (Cassandra).
- Need SQL semantics and writes beyond one machine, multi-region? → NewSQL.
- Search by words or relevance? → Search engine, fed from the source of truth.
- Analytics over billions of rows? → Columnar warehouse, fed by CDC or ETL.
Model for your queries
In relational design you normalise first and query later. At scale, especially in NoSQL, you list the queries first and shape the data to answer each one with a single, cheap read.
Example: chat messages in Cassandra.
Query: "Get the latest 50 messages in conversation C."
TABLE messages_by_conversation
PRIMARY KEY ((conversation_id), message_id) -- partition key, then clustering key
WITH CLUSTERING ORDER BY (message_id DESC)All messages for one conversation live in one partition, sorted newest-first. The query is a single sequential read. Using a time-sortable message_id (Unique ID Generation in Distributed Systems) gives ordering for free.
Unbounded partitions. A group chat with 5 years of messages in one partition can grow to gigabytes and hurt the whole cluster. Bucket it: PRIMARY KEY ((conversation_id, month), message_id).