For years the choice looked binary. Relational databases gave you SQL and transactions on one server. NoSQL databases gave you horizontal scale by dropping joins, schemas or strong consistency. NewSQL, often called distributed SQL today, is the attempt to have both: the SQL interface and ACID transactions of a relational database, running across many nodes that share the data automatically. This cheat sheet compares the three.
The three options
Traditional SQL. PostgreSQL, MySQL, SQL Server, Oracle. One primary server owns the writes; replicas copy its log for reads and failover. Full SQL, joins, constraints and ACID transactions. Scales up with bigger hardware and out for reads with replicas. Spreading writes across several servers (sharding) is possible but usually handled by your application or an extension, and cross-shard transactions get hard.
NoSQL. MongoDB, Cassandra, DynamoDB, Redis and others. Several data models (document, wide-column, key-value, graph), each tuned for particular access patterns. Most are built to partition data across nodes. In exchange, they limit joins, rely on query-specific data modelling, and often offer weaker or tunable consistency by default, though several support transactions within limits.
NewSQL / distributed SQL. Google Spanner, CockroachDB, TiDB, YugabyteDB. The data is split into ranges or shards, each replicated across nodes with a consensus protocol such as Raft or Paxos. A SQL layer on top hides the distribution: you write normal SQL, and the database routes queries and runs distributed transactions. Several of them speak the PostgreSQL or MySQL wire protocol, so existing drivers work, but compatibility is never complete.
Side by side
| Traditional SQL | NoSQL | NewSQL | |
|---|---|---|---|
| Data model | tables | document, key-value, wide-column, graph | tables |
| Query language | SQL | product-specific APIs, some SQL-like | SQL |
| Transactions | ACID on one server | often limited or per partition | ACID across nodes |
| Consistency | strong on the primary | often tunable or eventual | strong, via consensus |
| Write scaling | one primary | horizontal | horizontal |
| Write latency | low, local commit | low, often single-node | higher, needs a quorum |
| Operations | well known, mature | varies by product | newer, more moving parts |
| Typical fit | most applications | specific access patterns at scale | relational data beyond one server |
The trade-offs behind the table
Consistency costs latency. A distributed transaction must be agreed by a majority of replicas before it commits. Within one region that adds a little time; across regions it adds network round trips. NewSQL hides the complexity, not the physics.
NoSQL scale comes from the data model. Cassandra or DynamoDB scale writes well partly because each query targets one partition and there are no cross-partition joins. Your schema design does part of the work the database does not.
A single server goes far. Modern hardware with a well-indexed relational database handles a large share of real-world applications. Read replicas, caching and partitioning large tables extend it further. Many teams never need more.
Compatibility is a spectrum. A distributed SQL database that speaks the PostgreSQL protocol may not support every extension, function or locking behaviour. Test your real queries before migrating.
Operations matter. A NewSQL cluster is a distributed system: node failures, rebalancing, clock synchronisation (Spanner relies on tightly synchronised clocks; others use hybrid logical clocks) and multi-node upgrades. Managed cloud offerings reduce this burden at a price.
Common mistakes
- Choosing a distributed database for a workload that fits comfortably on one server, and paying in latency and complexity.
- Expecting a NewSQL database to be a drop-in replacement without testing queries, transactions and performance.
- Choosing NoSQL for scale, then needing cross-entity transactions and ad-hoc queries it was not designed for.
- Ignoring data locality: in multi-region setups, where each row lives decides how fast it can be read and written.
When to pick which
- Pick traditional SQL as the default: business applications, SaaS products, internal tools, anything with relational data that fits on one primary plus replicas. It is the simplest to run and the best understood.
- Pick NoSQL when a specific data model or access pattern fits it naturally: a document per object, a cache, high-volume event or time-series writes, graph traversals, or massive key-value workloads with known queries.
- Pick NewSQL when you need relational data and ACID transactions, and you have outgrown a single primary for writes, or you need the database to survive the loss of a node or region with automatic failover and strong consistency. Typical examples are global user-facing systems and financial ledgers that must stay consistent across regions.
- Combine them when it helps. A relational source of truth, a key-value cache and a specialised store for one heavy workload is a common and reasonable shape.
Watch the animated version: https://youtu.be/M61LS2d9chs
Originally published at abdeldjalilchougui.biz.
Top comments (0)