SQL vs NoSQL System Design Guide
SQL vs NoSQL System Design Guide
Decision Guide
SQL vs NoSQL · Every Tradeoff That Matters
SYSTEM DESIGN REFERENCE SERIES For architects, backend & platform engineers
SYSTEM DESIGN REFERENCE SQL vs NoSQL · Tradeoffs & Decisions
1 · Foundations
Every system-design database decision reduces to a small set of forces: the shape of your data, the access patterns of
your queries, the consistency your business can tolerate, and the scale you must reach. "SQL vs NoSQL" is shorthand
for two different sets of default answers to those forces — neither is universally better. The goal of this guide is to make
the tradeoffs explicit so the choice becomes an engineering decision rather than a preference.
Data model Tables with rows & columns; rigid, predefined Document, key-value, wide-column, or graph;
schema flexible/dynamic schema
Query language Standardized SQL (declarative, joins, Varies per engine (APIs, JSON queries, CQL,
aggregates) Cypher, etc.)
Relationships Native joins & foreign keys across tables Denormalized/embedded; joins avoided or done in
the app layer
Scaling default Vertical (scale up); harder to shard Horizontal (scale out); sharding is a first-class
concern
Consistency Strong (ACID transactions) Often eventual/tunable (BASE); some offer ACID
default
Best fit Structured data, complex queries, transactional Large scale, high write throughput, evolving or
integrity semi-structured data
Key mental model: SQL optimizes for consistency and query flexibility on a well-understood schema; NoSQL
optimizes for scale, availability, and schema flexibility, usually by giving up some consistency or ad-hoc query power.
You trade one set of guarantees for another.
Isolation levels (SQL) are themselves a tradeoff dial — from weakest to strongest: Read Uncommitted → Read
Committed → Repeatable Read → Serializable. Stronger isolation prevents more anomalies (dirty reads,
non-repeatable reads, phantom reads) but reduces concurrency and throughput.
Because network partitions are unavoidable in any real distributed system, P is non-negotiable. The real choice
under partition is C vs A.
AP Always responds, possibly with stale Cassandra, DynamoDB, Uptime matters most:
(Availability + Partition data — sacrifices strong consistency CouchDB, Riak social feeds, carts,
tol.) telemetry, catalogs
• Fastest possible lookups (O(1) by key) • Cannot query by value or across records
• Trivial horizontal scaling & partitioning • No relationships or joins
• Ideal for caching, sessions, feature flags, rate-limiting • Value is opaque — no server-side filtering
Examples: Redis, Amazon DynamoDB, Memcached, Riak KV, etcd.
• Flexible schema — fields vary per document • Multi-document joins are weak/manual
• Maps naturally to application objects (no ORM • Denormalization causes data duplication
impedance) • Consistency across documents is harder
• Rich secondary indexes & ad-hoc queries • Large embedded docs can hurt performance
• Good for content, catalogs, user profiles, CMS
Examples: MongoDB, Couchbase, Amazon DocumentDB, Firestore.
• Enormous write & read throughput at scale • Data model driven by queries — must design tables per
• Linear horizontal scalability across clusters access pattern
• Tunable consistency per query • No joins; ad-hoc queries are painful
• Great for time-series, IoT, logging, event data • Poor fit for highly relational data
Examples: Apache Cassandra, ScyllaDB, HBase, Google Bigtable.
• Traverses deep/complex relationships in constant time • Not built for bulk analytical scans over all nodes
per hop • Horizontal scaling/sharding is genuinely hard
• Ideal for fraud detection, recommendations, social • Niche — overkill for simple, tabular data
graphs, knowledge graphs
• Expressive traversal languages (Cypher, Gremlin)
Examples: Neo4j, Amazon Neptune, ArangoDB, JanusGraph, TigerGraph.
Cost curve Grows steeply at the high end Commodity hardware; near-linear
Normalized No duplication; consistent updates in one Reads need joins → slower at scale; more
(SQL default) place; storage-efficient complex queries
Denormalized Reads are single-lookup & fast; scales Data duplicated; updates must touch many
(NoSQL default) horizontally; no joins copies; risk of drift
Rule of thumb: normalize for write-heavy, integrity-critical systems; denormalize for read-heavy, latency-sensitive
systems at scale. Model NoSQL schemas around your queries, not your entities.
Data structure Structured, uniform, well-defined relationships Semi/unstructured, sparse, or rapidly evolving
Schema stability Schema is stable & known upfront Schema changes often; fields differ per record
Query patterns Complex, ad-hoc, analytical, multi-table joins Simple, known, key-based access patterns
Scale (volume) Moderate; fits vertical scaling Massive; needs horizontal scale-out
Write throughput Moderate write rates Very high, distributed write volume
Read latency Acceptable with proper indexing Ultra-low latency at scale is required
Availability need Can tolerate brief downtime for correctness Must stay available under partition/failure
Team & ecosystem Mature tooling, SQL skills, reporting/BI needs Cloud-native, flexible, rapid iteration
Step-by-step
• 1. What is the shape of the data? Tabular & relational → lean SQL. Nested documents → document store. Pure
lookups → key-value. Deep relationships → graph. Time-series/event floods → wide-column.
• 2. What are the dominant access patterns? Design around the 80% of queries. Ad-hoc analytics → SQL. Known
key-based reads → NoSQL.
• 3. What consistency does the business truly require? Money/inventory/bookings → strong (CP / ACID).
Feeds/telemetry/carts → eventual (AP / BASE) is usually fine.
• 4. What scale & throughput must you reach? If a single beefy node (plus read replicas) suffices for years → SQL. If
you need to shard across many nodes for write volume → NoSQL / NewSQL.
• 5. What are the availability & latency SLAs? Map them onto CAP/PACELC: 'always-on, low-latency, global' pushes
toward AP/EL systems.
• 6. How stable is the schema & how fast must the team iterate? Volatile schema + rapid iteration favors flexible
NoSQL; regulated, stable domains favor SQL.
• 7. What does the team/ecosystem already know & operate well? Operability and skills are a real tradeoff — the
'best' engine you can't run reliably is the wrong choice.
Bottom line: There is no 'best' database — only the best fit for a specific set of data shapes, access patterns,
consistency needs, and scale targets. Make the tradeoffs explicit, map them to CAP/PACELC, and let the
requirements choose the engine.