Technology Comparisons
Side-by-side comparisons of common system design technologies. Know the trade-offs to make informed decisions in interviews.
SQL vs NoSQL
When to use relational vs non-relational databases
| Attribute | SQL (PostgreSQL, MySQL) Relational database with structured schemas and ACID transactions | NoSQL (MongoDB, DynamoDB, Cassandra) Non-relational databases optimized for specific access patterns |
|---|---|---|
| Schema | Fixed, predefined schema with tables and relations | Flexible, schema-less or schema-on-read |
| Scaling | Primarily vertical (read replicas for reads) | Horizontal scaling by design (auto-sharding) |
| Query Language | SQL - powerful joins, aggregations, subqueries | API-based, limited query flexibility |
| Consistency | Strong consistency (ACID) | Eventual consistency (tunable in some) |
| Best For | Complex queries, transactions, relational data | Simple access patterns, massive scale, high write throughput |
| Throughput | ~10K-50K QPS per node | ~100K+ QPS, scales linearly with nodes |
| Examples | User accounts, orders, financial data, inventory | Session data, IoT, content catalogs, real-time analytics |
| Scaling Limit | Single node ~1-2TB comfortable, sharding is complex | Virtually unlimited with proper partitioning |
When to Use Which?
Use SQL when you need complex queries, joins, or ACID transactions. Use NoSQL for simple key-value access at massive scale. Many systems use BOTH.