Skip to content
Naveen Raj

System Design Fundamentals · The Data Layer

SQL vs. NoSQL: Choosing a Database

The SQL vs. NoSQL question is really several smaller questions bundled together, and "NoSQL is more scalable" is not, on its own, a real answer — plenty of relational databases run at enormous scale.

What actually differs

Relational (SQL)Non-relational (NoSQL)
SchemaFixed, enforced at write timeFlexible / schema-less
RelationshipsFirst-class (joins, foreign keys)Usually denormalized instead
ConsistencyStrong by default (ACID transactions)Often eventual, tunable
Scaling modelVertical first, horizontal is harderBuilt for horizontal from the start
Query flexibilityArbitrary queries via SQLOften optimized for specific access patterns

The question that actually decides it

Not "which is faster" — "do I know my access patterns in advance, and do they need multi-record transactions?"

  • If your data has real relationships you need to query flexibly (a JOINs-heavy admin dashboard, financial records, anything needing multi-row transactions) — relational is usually right, even at scale.
  • If you have one or two dominant, known access patterns ("get a user's timeline by user ID," "get a product by SKU") and need to scale horizontally without operational pain — a NoSQL store built around that access pattern (DynamoDB, Cassandra, MongoDB) often fits better, because you can denormalize around the query instead of normalizing around the data.

A concrete rule of thumb

Need ACID transactions across multiple records?        → SQL
Schema will change frequently and unpredictably?        → NoSQL
Access pattern is a single, known lookup (by key)?       → NoSQL
Need arbitrary, ad-hoc queries across relationships?     → SQL

Most real systems end up using both — a relational database for the core transactional data (orders, accounts, payments) and a NoSQL store for a specific high-volume, simple-access-pattern workload (session data, activity feeds, caching layers). "Pick one database for the whole system" is itself often the wrong framing.

SQL vs. NoSQL: Choosing a Database — System Design Fundamentals — Naveen Raj