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
SchemaFixed, predefined schema with tables and relationsFlexible, schema-less or schema-on-read
ScalingPrimarily vertical (read replicas for reads)Horizontal scaling by design (auto-sharding)
Query LanguageSQL - powerful joins, aggregations, subqueriesAPI-based, limited query flexibility
ConsistencyStrong consistency (ACID)Eventual consistency (tunable in some)
Best ForComplex queries, transactions, relational dataSimple access patterns, massive scale, high write throughput
Throughput~10K-50K QPS per node~100K+ QPS, scales linearly with nodes
ExamplesUser accounts, orders, financial data, inventorySession data, IoT, content catalogs, real-time analytics
Scaling LimitSingle node ~1-2TB comfortable, sharding is complexVirtually 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.