CockroachDB
Distributed Postgres-compatible SQL. Strong consistency at global scale, relicensed in 2024.
VISIT COCKROACHDBKey takeaway: Multi-region writes with strong consistency is a genuinely hard problem, and CockroachDB is one of the few honest answers to it. It is also the wrong answer for the overwhelming majority of applications, which are single-region and would be faster, cheaper, and simpler on Neon or Supabase. Pick it when data residency or true global write availability is a stated requirement.
Quick facts
- CategoryPostgres
- EnginePostgres
- PricingPaid
- LicenseCockroachDB Software License (BSL-like, 2024)
- Created2014
- GitHub stars30.5k
- PostgresCompatible
- Edge-readyNo
Bundled features: Multi-region Strong consistency
What it is
CockroachDB is a distributed SQL database with Postgres compatibility, strong consistency, and global multi-region replication. Cockroach Cloud is the managed serverless offering. The license shifted to CSL (Cockroach Software License) in late 2024, restricting commercial use of self-hosted deployments, controversial but the SaaS product is unaffected.
Best for
- Apps that need genuine multi-region writes with strong consistency
- Workloads where geographic data residency matters per-row
- Large enterprises with HA + DR requirements that exceed single-region Postgres
When not to pick it
Skip Cockroach for most apps, the operational complexity and pricing are real and most workloads do not need distributed SQL. Skip if the 2024 license change is a concern for self-hosted use.
My take
Cockroach is the right answer for genuine global-scale SQL workloads. For everyone else (most teams) it is overkill and Supabase / Neon are the right fit.
Consensus has a latency bill, and you will pay it
Cockroach achieves strong consistency across regions by replicating ranges and requiring a quorum before a write commits. That is the correct design and it is why the database survives a region going dark without losing data. It also means a write can wait on a round trip to another continent, and that cost shows up in exactly the transactions your users notice. The mitigation is locality-aware schema design: pinning rows to the region that owns them so most writes stay local, and accepting slower cross-region operations as the exception. That works well, but it is a modelling exercise you do deliberately at design time, not a switch you flip afterwards. Run a single-region application on Cockroach without doing it and you get worse latency and a larger bill than plain Postgres would have delivered, in exchange for resilience you are not using.
Postgres compatible is not the same as Postgres
Cockroach speaks the Postgres wire protocol, so your driver connects, your ORM mostly works, and the SQL you know is broadly the SQL you write. Below that surface it is a different engine with a different query planner and a different execution model. Extensions are the sharpest edge: you cannot assume a Postgres extension your application relies on exists here, and plans that were fine on a single node can behave differently across distributed ranges. Treat the compatibility as a large head start rather than a guarantee, and benchmark your real workload before committing to a date. On licensing, the move to the Cockroach Software License restricts commercial self-hosted use while leaving the managed cloud product unaffected. If your plan was to run it yourself commercially, read the terms first; if you were always going to buy the managed service, nothing changes.
Frequently asked questions
Is CockroachDB open source?
No longer in the conventional sense. The licence moved to the Cockroach Software License, which restricts commercial use of self-hosted deployments. The source remains readable and the managed cloud product is unaffected. If self-hosting commercially was the plan, read the current terms before building on the assumption that it is permitted.
Is CockroachDB a drop-in replacement for Postgres?
It speaks the Postgres wire protocol, so drivers and most ORMs connect without change, but it is a different engine underneath. Extension availability, query planner behaviour, and some SQL features differ. Treat it as a large head start on migration rather than a guarantee, and benchmark your real queries before you commit to a cutover date.
CockroachDB or Neon?
Neon for almost everything. It is real Postgres, cheaper, simpler, and fast for single-region workloads, which is what most applications are. CockroachDB earns the pick when you need genuine multi-region writes with strong consistency, per-row data residency, or availability guarantees a single-region Postgres cannot make. Those are requirements, not aspirations.
Links
Compare CockroachDB side-by-side
Similar tools you should also consider
If CockroachDB is your pick, the next conversation is short
The 30-min call is where your database choice becomes a real architecture, a migration plan if you are switching, and a price range you can take to your stakeholders. Describe your stack, your scale, your data shape. I tell you whether CockroachDB is genuinely your fit.