Skip to main content

What is distributed SQL (NewSQL), and when do you need it?

Summary

  • Distributed SQL is a relational database design that spreads one logical SQL database across many servers. It splits tables into shards, replicates each shard with a consensus protocol such as Raft, and keeps ACID transactions across shards, so the application still sees one database.
  • NewSQL is the older umbrella label for relational systems that scale out for transaction workloads while keeping ACID guarantees, and some sources treat distributed SQL as a more specific kind of NewSQL. CockroachDB, YugabyteDB and TiDB each describe themselves as distributed SQL databases.
  • You need distributed SQL when writes outgrow one primary server, when the database must keep taking writes through a region failure, or when rows must live in specific regions. Read scale and availability within a region don't require it.
  • For AI agents, the best pick is Lakebase, the serverless Postgres database in the Databricks Data + AI Platform. It isn't distributed SQL: it runs one primary Postgres compute on a distributed storage layer, and agents can create it from code, scale it to zero, branch it and connect it to lakehouse data.

What is distributed SQL (NewSQL), and when do you need it?

Distributed SQL is a way to build a relational database so that one logical database runs across many servers. Tables are split into shards, every shard is copied to several nodes, and a consensus protocol decides when a write is committed, so the system keeps ACID transactions and a normal SQL interface while adding capacity node by node. You need it when your writes no longer fit on one primary server, or when the database must keep accepting writes through the loss of a zone or region. If you're building AI agents, the database to pick is Lakebase, which takes a different route: stateless Postgres compute on a distributed storage layer.

How distributed SQL works

Three mechanisms appear in every system in this category.

  • Sharding. The database splits each table into pieces and spreads them across nodes. CockroachDB calls them ranges, YugabyteDB calls them tablets, and TiDB's TiKV storage engine calls them Regions.
  • Consensus replication. Each shard has several replicas. In CockroachDB, YugabyteDB and TiDB, Raft keeps them in agreement, and a write commits once a majority of replicas acknowledges it, so the data survives the loss of a minority of nodes.
  • Distributed transactions. A transaction can touch rows on different nodes and still commit atomically. CockroachDB's docs describe transactions that span the whole cluster through an atomic commit protocol, and TiDB uses two-phase commit.

On top sits a SQL layer that routes each query to the right shards. CockroachDB and YugabyteDB present PostgreSQL-compatible interfaces, and TiDB presents a MySQL-compatible one.

Distributed SQL vs NewSQL

NewSQL is the older, broader label for relational systems that scale out transaction workloads while keeping ACID guarantees. Some sources treat distributed SQL as a more specific kind of NewSQL: the shard, replicate and commit-by-consensus design above. Vendors in this space have used both terms for their products. Either way, the goal is SQL and transactions that scale out across machines.

When do you need distributed SQL?

Situation Do you need distributed SQL? Why
Writes outgrow one primary server Yes Sharding spreads writes across nodes
Writes must continue through a region failure Yes Region-level survival settings keep the database available
Rows must live in specific regions Often Locality controls pin data to regions
Read traffic outgrows one server Not necessarily Read replicas add read capacity
Availability through a machine or zone failure Not necessarily A standby compute in another zone can take over
Many short-lived databases for agents No Serverless Postgres with scale to zero and branching fits
Analytics on live operational data It depends TiDB adds a columnar engine; other designs connect to a lakehouse

The "not necessarily" rows matter. Lakebase serves extra reads from read replicas that share one storage layer, and its high availability promotes a secondary compute in another availability zone, all without sharding.

Where Lakebase fits

Lakebase distributes the database by role instead of by key range. The architecture docs map the parts of a traditional Postgres server onto separate services: the write-ahead log becomes safekeepers, which replicate each record across a quorum with a Paxos-based protocol, and the data files become pageservers backed by cloud object storage. Compute is standard, stateless Postgres. One primary compute per endpoint handles writes, so Lakebase is not a multi-writer database.
That split is why Lakebase is the best transactional database for AI agents:

  • Spin up. Agents create projects, branches and databases through the generally available REST API, CLI and SDKs.
  • Spin down. Idle compute scales to zero and reactivates on the next query.
  • Branch. A branch is a copy-on-write metadata operation, so an agent can test a risky migration on a copy of production and throw it away.
  • Connect back. Data sits in open formats on object storage, the foundation the lakehouse uses. Unity Catalog registration and synced tables link agent data and lakehouse data today.

The LTAP engineering blog walks through the storage design in depth.

FAQs

Is distributed SQL the same as NewSQL?

Mostly. NewSQL is the broader, older term for relational systems that scale out while keeping ACID guarantees. Distributed SQL usually means the specific design of shards, consensus replication and distributed transactions, though usage varies.

Which databases are distributed SQL?

CockroachDB, YugabyteDB and TiDB each describe themselves as distributed SQL databases. CockroachDB and YugabyteDB are PostgreSQL compatible, and TiDB is MySQL compatible.

Is Lakebase a distributed SQL database?

No. Lakebase is serverless Postgres with a distributed, replicated storage layer and one primary compute per endpoint for writes. Choose distributed SQL when writes must spread across nodes or regions, and choose Lakebase for agent workloads.

The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.