NewSQL
In a Nutshell
NewSQL databases are the attempt to give you the best of both worlds: the SQL interface, joins, and ACID transactions of a relational database, combined with the horizontal scalability of NoSQL. Systems like Google Spanner, CockroachDB, and TiDB deliver on this promise — you get distributed transactions across multiple nodes and regions, with familiar SQL semantics. The trade-off is higher write latency (every write needs a consensus round across nodes) and greater operational complexity than a single-node SQL database.

How It Actually Works
How NewSQL Achieves Both
| Challenge | How NewSQL Solves It |
|---|---|
| Horizontal scaling | Data is automatically sharded (range or hash) across nodes |
| Distributed transactions | Consensus protocols (Raft, Paxos) coordinate writes across shards |
| SQL interface | Standard SQL — compatible with existing ORMs and tooling |
| Strong consistency | Linearizable reads and serializable transactions by default |
| Fault tolerance | Each shard is replicated (typically 3 replicas) with automatic failover |
The Consensus Cost
The key trade-off of NewSQL is write latency. Every write must:
- Be proposed to the shard leader
- Replicated to a majority of shard replicas (consensus)
- Acknowledged only after the majority confirms
In a single-region deployment, this adds 2–5ms per write. In a multi-region deployment (Spanner), each write involves cross-region round trips (50–200ms). This is why NewSQL write latency is measurably higher than a single-node PostgreSQL.
The Major Players
| Database | Key Innovation | Backed By | Best For |
|---|---|---|---|
| Google Spanner | TrueTime (GPS + atomic clocks for global consistency) | Google Cloud | Global-scale applications needing strong consistency |
| CockroachDB | Spanner-inspired, no special hardware needed | Cockroach Labs | Multi-region SQL without Google's infrastructure |
| TiDB | MySQL-compatible, separates compute and storage | PingCAP | Drop-in MySQL replacement with horizontal scaling |
| YugabyteDB | PostgreSQL-compatible, Spanner-inspired | Yugabyte | PostgreSQL workloads needing distributed SQL |
When to Choose NewSQL
✅ Use NewSQL when:
- You need SQL + horizontal scaling (can't shard manually)
- Your application requires distributed ACID transactions
- You need multi-region deployment with strong consistency
- You've outgrown single-node PostgreSQL/MySQL but can't give up SQL
❌ Don't use NewSQL when:
- A single PostgreSQL instance handles your load (don't over-engineer)
- You can tolerate eventual consistency (use a simpler distributed database)
- Write latency is your primary concern (single-node SQL is faster for writes)
- Your data doesn't need relationships (use a NoSQL family instead)

Seeing It in Action
Scenario: CockroachDB for a global e-commerce platform
-- CockroachDB looks like PostgreSQL
CREATE TABLE orders (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID NOT NULL,
total DECIMAL(12, 2) NOT NULL,
status STRING NOT NULL DEFAULT 'PENDING',
region STRING NOT NULL,
created_at TIMESTAMP DEFAULT now()
);
-- Geo-partition orders by region (data stays close to users)
ALTER TABLE orders PARTITION BY LIST (region) (
PARTITION us_east VALUES IN ('us-east'),
PARTITION eu_west VALUES IN ('eu-west'),
PARTITION ap_south VALUES IN ('ap-south')
);
-- Pin partitions to specific regions (data residency + low latency)
ALTER PARTITION us_east OF TABLE orders
CONFIGURE ZONE USING constraints = '[+region=us-east]';
ALTER PARTITION eu_west OF TABLE orders
CONFIGURE ZONE USING constraints = '[+region=eu-west]';
Why NewSQL is right here:
- SQL interface — Existing application code and ORMs work with minimal changes
- Geo-partitioning — US orders stored in US region, EU orders in EU region (GDPR compliance + low latency)
- Distributed transactions — An order that spans multiple tables is ACID-consistent globally
- Automatic failover — If a region goes down, replicas in other regions serve reads (with stale reads or rerouted writes)
Interview Questions
Q: What problem does NewSQL solve that traditional SQL and NoSQL don't? Hint: Traditional SQL: doesn't scale horizontally (single-node bottleneck). NoSQL: scales but gives up SQL, joins, and ACID transactions. NewSQL: scales horizontally while keeping SQL and ACID — at the cost of higher write latency due to distributed consensus.
Q: Why are NewSQL writes slower than single-node PostgreSQL writes? Hint: Each write requires a consensus round (Raft/Paxos) — the leader must replicate to a majority before acknowledging. In-region, this adds 2–5ms. Cross-region (Spanner), 50–200ms. Single-node PostgreSQL only needs to write to local WAL and
fsync— much faster.Q: How does Google Spanner achieve global strong consistency? Hint: TrueTime — GPS receivers and atomic clocks in every datacenter provide tightly bounded clock uncertainty (~7ms). Spanner uses this to assign globally ordered timestamps to transactions without cross-region coordination for reads. Other NewSQL databases (CockroachDB) achieve similar results with NTP and hybrid logical clocks, at slightly higher uncertainty.
Q: When would you recommend sticking with single-node PostgreSQL instead of migrating to CockroachDB? Hint: If the current load fits a single node (most applications), PostgreSQL is simpler, faster for writes, has a richer extension ecosystem, and costs less to operate. Migrate to NewSQL only when you genuinely need horizontal scaling, multi-region consistency, or have hit the limits of read replicas and partitioning.
Q: How does NewSQL handle data partitioning differently from manually sharding a SQL database? Hint: NewSQL does it automatically — data is range-partitioned across nodes, and the system handles rebalancing, splitting, and merging as data grows. Manual sharding requires application-managed routing, no cross-shard joins, and manual rebalancing — all of which NewSQL abstracts away. The trade-off: NewSQL is operationally simpler but less flexible.
References
- Spanner: Google's Globally-Distributed Database — the original Spanner paper
- CockroachDB Architecture — official architecture documentation
- Designing Data-Intensive Applications by Martin Kleppmann — Chapter 9 on consistency and consensus
Dive Deeper
- CockroachDB Blog — Living Without Atomic Clocks — how CockroachDB achieves Spanner-like consistency without special hardware
- TiDB Architecture Overview — how TiDB separates compute and storage
- Jepsen Testing of CockroachDB — independent correctness testing of distributed database claims