Roadmap › System Design — High-Level Design (HLD) from Basics to Case Studies › Module: Building Blocks
Lessons in this course (14)
6. Choosing the database — SQL vs NoSQL
Intermediate★ Must knowLesson 6 of 14
| Type | Examples | Strengths | Use for |
|---|---|---|---|
| Relational (SQL) | SQL Server, PostgreSQL, MySQL, Azure SQL | ACID transactions, joins, constraints, mature tooling | Orders, payments, inventory, most business data |
| Key-value | Redis, DynamoDB | Very fast simple lookups | Cache, sessions, counters, leaderboards |
| Document | MongoDB, Cosmos DB | Flexible JSON documents, easy scaling | Catalogs, user profiles, content |
| Wide-column | Cassandra, ScyllaDB | Massive write throughput, time-ordered data | IoT telemetry, messaging history, activity logs |
| Graph | Neo4j, Cosmos DB Gremlin | Relationships and traversals | Social graphs, recommendations, fraud |
| Time-series | InfluxDB, TimescaleDB, Azure Data Explorer | Time-bucketed metrics | Monitoring, sensors |
| Search | Elasticsearch, Azure AI Search | Full-text search, ranking, facets | Product search, logs |
| Object storage | Azure Blob, S3 | Huge files cheaply | Images, videos, backups |
| Vector | pgvector, Azure AI Search vectors, Qdrant | Similarity search on embeddings | AI/RAG, recommendations |
Default: start with a relational database unless a specific need (massive scale for simple access patterns, flexible schema, special query type) points elsewhere. Many systems are polyglot — SQL for transactions + Redis + Blob + search index.