Cloud Parts

CockroachDB

A distributed SQL database that speaks the PostgreSQL wire protocol, replicates every slice of data with Raft and keeps transactions serializable across nodes and regions.

Type
Commercial product
Made by
Cockroach Labs, Inc.
License
CockroachDB Software License (proprietary, source available) since v24.3 in November 2024; before that Business Source License 1.1 plus the CockroachDB Community License from v19.2 (2019), and Apache 2.0 for the core until v19.1
Facts checked
6 October 2026

What it is

Every node runs the same cockroach binary, and any node accepts SQL over the PostgreSQL wire protocol, so a load balancer can send clients anywhere. The SQL layer turns rows and indexes into key-value pairs in one sorted keyspace, cut into ranges of up to 512 MiB that split and merge on their own. Each range is copied to three nodes by default and forms its own Raft group: a write commits once a majority of its replicas agree, and one replica, the leaseholder, serves reads and coordinates writes for that range. On disk each node keeps its replicas in Pebble, an LSM key-value store written in Go that replaced RocksDB as the default in 20.2 (2020), with several timestamped versions of every key (MVCC). Transactions are SERIALIZABLE by default; READ COMMITTED has been available since 23.2. Instead of Spanner’s atomic clocks, nodes use hybrid logical clocks over NTP: a node whose clock drifts more than the maximum offset (500 ms by default) from the others shuts itself down, and a read that meets a value inside that uncertainty window restarts at a later timestamp. For multi-region clusters you tag nodes with their region, then mark each table REGIONAL BY TABLE, REGIONAL BY ROW (each row lives in the region named in a hidden crdb_region column) or GLOBAL (fast reads everywhere, slower writes). Changefeeds stream row changes to Kafka, Pub/Sub, cloud storage or webhooks.

Since November 2024 all of CockroachDB is under the proprietary CockroachDB Software License: the source is on GitHub, but production clusters need a license key from Cockroach Labs. Enterprise Free costs nothing for businesses under $10 million in annual revenue, is renewed each year and requires the cluster to send telemetry; a cluster without a key, or that stops sending telemetry, is throttled after 7 days to 5 concurrent open transactions. A single-node development cluster needs no key. Larger companies buy Enterprise through sales. The managed service changed on 15 September 2026: new organizations get Cockroach Continuum, billed per provisioned vCPU-hour ($0.092 for Standard and $0.162 for Mission Critical in AWS us-east-1), plus storage, backups and data transfer, with a 30-day trial and $400 of credit. The older Basic, Standard and Advanced plans, including Basic’s free monthly allowance, remain only for clusters created before that date.

Why teams pick it

  • Survives the loss of a node, a zone or, with SURVIVE REGION FAILURE, a whole region without manual failover, because every range commits through a Raft majority
  • Scales writes as well as reads by adding nodes: ranges split and rebalance automatically, and Cockroach Labs reports 300-node clusters tested and over 250 nodes in one production cluster
  • Serializable transactions and strong consistency on ordinary hardware, on any cloud or on premises, including Kubernetes through the CockroachDB operator
  • Row-level data placement: REGIONAL BY ROW keeps each customer’s rows near them (and inside their jurisdiction), while GLOBAL tables serve local reads in every region
  • Speaks the PostgreSQL wire protocol, so psql and Postgres drivers connect unchanged, and has built-in change data capture to Kafka, Pub/Sub, S3, GCS, Azure Blob Storage and webhooks

Watch out for

  • No longer open source: free production use is limited to businesses under $10 million in revenue, renewed yearly and with mandatory telemetry; without a valid key the cluster is throttled, and the licence also adds conditions on publishing benchmarks
  • PostgreSQL-compatible, not PostgreSQL: no range types, XML functions, column-level privileges, foreign data wrappers or session-scoped advisory locks, and integer division returns a decimal
  • Serializable isolation means retry errors (SQLSTATE 40001): CockroachDB retries automatically only when a transaction arrives as one batch, so applications need retry loops or READ COMMITTED
  • Every write waits for a Raft majority, so a cluster that survives region loss pays cross-region round trips on writes, and nodes crash rather than serve data if clocks drift past the maximum offset
  • New Cloud organizations have no free tier since 15 September 2026, idle clusters are billed for provisioned vCPUs, an edition can’t be changed in place, and Mission Critical bills provisioned storage at 4.5 times the data size ($0.155 per GiB-month in us-east-1)

Alternatives

What all relational databases have in common →
Alibaba Cloud PolarDBCommercialAlibaba Cloud’s cloud-native relational databases: MySQL- and PostgreSQL-compatible clusters whose compute nodes share one copy of the data on distributed storage, plus PolarDB-X, a distributed MySQL-compatible edition.CedarDBCommercialA PostgreSQL-compatible database rebuilt from scratch at TU Munich, running transactions and analytics on one copy of the data on a single server.Cloudflare D1CommercialCloudflare’s serverless SQL database that speaks SQLite, runs each database inside a Durable Object, and bills by rows read and written rather than by the hour.CloudNativePGOpen sourceA Kubernetes operator that runs highly available PostgreSQL with no Patroni and no StatefulSets: the Kubernetes API itself holds the cluster’s state.MySQLOpen sourceThe long-standing open-source SQL database behind much of the web, built on the InnoDB engine.NeonCommercialServerless Postgres that keeps data in a shared storage layer, so compute can scale to zero and a branch of the database is a pointer, not a copy.PatroniOpen sourceA Python agent beside each Postgres server that elects one primary through etcd, Consul, ZooKeeper or Kubernetes, and fails over when it dies.Percona OperatorsOpen sourceFour free Kubernetes operators from Percona that run its builds of MySQL, PostgreSQL and MongoDB, each using the engine’s own replication and backup tools.PGO (Crunchy Postgres for Kubernetes)Open sourceCrunchy Data’s Postgres operator: Patroni in every pod for failover, pgBackRest for backups, and a declarative `PostgresCluster` resource on top.PlanetScaleCommercialManaged MySQL on Vitess and managed Postgres, with schema changes shipped through branches and deploy requests.PostgreSQLOpen sourceThe open-source relational database that most new projects start on, extensible enough to grow into many niches.ScramDBCommercialA brand-new, closed-source database that speaks the PostgreSQL protocol and promises transactions, analytics and vector search on one copy of the data; first builds shipped in summer 2026.SQLiteOpen sourceA complete SQL database in a library and a single file, with no server to run.TursoOpen sourceA from-scratch Rust rewrite of SQLite with concurrent writes, plus libSQL (an open-contribution SQLite fork) and Turso Cloud, which hosts many small databases on S3.VitessOpen sourceA proxy layer, born at YouTube, that shards MySQL across many servers while the app still sees one database.

How it fits with other technologies

A three-region database: rows homed near their customers, a global lookup table, a changefeed · sql

-- nodes were started with --locality=region=us-east1 (and us-west1, europe-west1)
SHOW REGIONS FROM CLUSTER;

CREATE DATABASE shop PRIMARY REGION "us-east1" REGIONS "us-west1", "europe-west1"
  SURVIVE REGION FAILURE;            -- keep working if a whole region goes down
USE shop;

-- each row's leaseholder sits in the region stored in the hidden crdb_region column
CREATE TABLE customers (
  id    UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  email STRING NOT NULL UNIQUE,
  name  STRING
) LOCALITY REGIONAL BY ROW;

-- read everywhere, written rarely: fast local reads, slower writes
CREATE TABLE currencies (
  code STRING PRIMARY KEY,
  name STRING NOT NULL
) LOCALITY GLOBAL;

INSERT INTO customers (email, name, crdb_region) VALUES ('ada@example.com', 'Ada', 'europe-west1');
SHOW TRANSACTION ISOLATION LEVEL;   -- serializable

-- stream every change to Kafka (self-hosted: SET CLUSTER SETTING kv.rangefeed.enabled = true first)
CREATE CHANGEFEED FOR TABLE customers INTO 'kafka://kafka:9092' WITH updated, resolved = '10s';

Which way to run it?#

Cloud prices are list prices for AWS us-east-1 from Cockroach Labs’ pricing page, checked 2026-10-06. They apply to organizations created on or after 15 September 2026; older clusters keep the Basic, Standard and Advanced plans.

Continuum StandardContinuum Mission CriticalSelf-hosted, Enterprise FreeSelf-hosted, Enterprise
Who runs itCockroach LabsCockroach LabsYouYou
InfrastructureShared; AWS and GCPDedicated; AWS, GCP and AzureAnywhere, including on premises and KubernetesAnywhere, including air-gapped
Price$0.092 per vCPU-hour; about $203 a month for 2 vCPUs and 100 GB$0.162 per vCPU-hour; about $1,528 a month for 12 vCPUs and 100 GBFree for businesses under $10M annual revenue, renewed yearlyQuote from sales
StorageUsage-basedProvisioned at 4.5 times the data size ($0.155 per GiB-month); usage-based in previewYour disksYour disks
Availability SLA99.99%99.999% with multi-regionNone: you run itNone: you run it
TelemetryNot applicableNot applicableRequired; throttled after 7 days without itCan be turned off
Change data captureAdd-on, $0.006 per vCPU-hourAdd-on, $0.023 per vCPU-hourIncludedIncluded
  • Cloud usage is metered by the minute; data transfer out of the cluster is billed separately. New organizations get a 30-day trial with $400 of credit, after which clusters pause and are deleted 30 days later without a payment method.
  • A single-node cluster for development or testing needs no license key and is never throttled.

CockroachDB, Spanner, Aurora DSQL or YugabyteDB?#

Four distributed SQL databases that replicate data across zones or regions with consensus. This site has no pages yet for the other three.

CockroachDBGoogle Cloud SpannerAmazon Aurora DSQLYugabyteDB
Where it runsSelf-hosted anywhere, or managed on AWS, GCP and AzureGoogle Cloud onlyAWS only, serverlessSelf-hosted anywhere, or managed
SQL interfaceIts own SQL engine speaking the PostgreSQL wire protocolGoogleSQL or a PostgreSQL dialect, through drivers or PGAdapterPostgreSQL 16 compatibleA modified fork of the PostgreSQL query layer (YSQL), plus a Cassandra-style API
Time and orderingHybrid logical clocks over NTP, 500 ms maximum offsetTrueTime: GPS and atomic clocks, commit waitManaged by AWS, not exposedHybrid logical clocks
IsolationSerializable by default; read committedExternal consistency (serializable)Snapshot isolationSnapshot, serializable and read committed
LicenceProprietary, source availableProprietary serviceProprietary serviceApache 2.0 database; management platform under a 32-day trial licence

See it in a real stack

No architecture uses CockroachDB yet. Drop it into the playground and wire it up yourself.Open playground →

Benchmarks

How to read a benchmark →
Where it came from2014–2026

In the early 2000s Spencer Kimball, Peter Mattis and Ben Darnell built infrastructure at Google, Kimball and Mattis on the Colossus file system and Darnell on Reader, and watched teams shard databases by hand inside their applications. In 2012 Kimball and Mattis left to build Viewfinder, a photo-sharing app, and found no open-source database that was both resilient at scale and transactionally correct, nothing like what they had left behind.

Kimball wrote the first design in 2014 and put it on GitHub: a sorted key-value map split into Raft-replicated ranges, serializable transactions by default, and data zones modelled on Google’s Spanner, but without Spanner’s atomic clocks. Cockroach Labs followed in 2015 with a $6.3 million seed round led by Benchmark, and 1.0 shipped in May 2017.

The licence tightened in steps. The core started under Apache 2.0, with enterprise features under the CockroachDB Community License. Version 19.2 moved the core to the Business Source License, which barred offering it as a commercial database service and turned each release into Apache 2.0 after about three years. In 2024 Cockroach Labs retired the free Core edition, and from v24.3 everything ships under its own proprietary licence.

Why it’s built this way

Spanner’s design without atomic clocks
Spanner relies on TrueTime hardware in Google’s data centres. Hybrid logical clocks with a bounded clock offset run on commodity machines in any cloud; the cost is occasional read restarts instead of Spanner’s wait after every write.
One Raft group per range
Replicating each small range independently lets data move, split and rebalance range by range, and a write needs only a majority of its own replicas to commit.
Serializable isolation by default
The design document says clients should have to consciously trade correctness for performance, not get weaker isolation by accident; read committed came only in 2024, for applications migrated from other databases.
The PostgreSQL wire protocol instead of a new client protocol
Speaking pgwire lets applications use existing PostgreSQL drivers and tools such as psql, while the storage and transaction layers underneath are entirely CockroachDB’s own.

Timeline

  1. 2014

    Spencer Kimball publishes the design on GitHub

  2. 2015

    Cockroach Labs founded; $6.3 million seed led by Benchmark

  3. 2017

    CockroachDB 1.0 in May, with a $27 million Series B

  4. 2019

    Version 19.2 moves the core from Apache 2.0 to the Business Source License

  5. 2024

    Read committed GA in 24.1; proprietary licence and Enterprise Free from 24.3

  6. 2026

    Cockroach Continuum replaces Cloud plans for new organizations

Sources32 · facts checked 6 October 2026

Improve this page on GitHub