CockroachDB

The SQL database for global cloud services.

Learn About Pricing Review the Architecture
Distributed SQL

Develop efficiently with distributed SQL that grows with your business

  • Reason with a single logical database that can scale horizontally across multiple data centers transparently to applications.
  • Use existing PostgreSQL client drivers or supported ORMs.
  • Interface with a robust SQL API that supports distributed ACID transactions, foreign keys, secondary indexes, JOINs, aggregations, and zero-downtime schema changes.
Learn about SQL support
$ brew install cockroachdb/cockroach/cockroach

$ cockroach start

CockroachDB node starting at 2017-05-10 16:35:27
build: v1.0 @ 2017/05/10 20:27:23 (go1.8.1)
admin: http://localhost:8080
postgresql: //[email protected]:26257
logs: cockroach-data/logs
store[0]: path=cockroach-data
status: initialized new cluster
clusterID: 801c40b-9d65-4991-b051-bd16108dc92
nodeID: 1
Class.forName("org.postgresql.Driver");

Connection db = DriverManager.getConnection("jdbc:postgresql://localhost:26257/bank", "maxroach", "");

try {db.createStatement().execute("CREATE TABLE accounts (id INT PRIMARY KEY, balance INT)");
db.createStatement().execute("INSERT INTO accounts (id, balance) VALUES (1, 1000), (2, 250)");
$ cockroach sql

# Welcome to the cockroach SQL interface.
# All statements must be terminated by a semicolon.
# To exit: CTRL + D.

> CREATE DATABASE bank;
CREATE DATABASE

> CREATE TABLE bank.accounts (
id INT PRIMARY KEY,
balance DECIMAL
);

CREATE TABLE

> INSERT INTO accounts VALUES (1, 10000.50);
INSERT 1
A world map with database symbols spread throughout.
Improved uptime

Maintain data integrity at scale

  • Provide always-on services with multi-active availability, a new standard of availability that uses groups of symmetric nodes to intelligently agree on write success. Once consensus is reached, writes are instantly readable from any node in the cluster.
  • Send R/W traffic to any CockroachDB node - all nodes are symmetric and serve as client gateways.
  • Dynamically load balance to healthy nodes instead of using complex and error-prone failover setups.
  • Achieve greater data redundancy and availability with consistent replication across nodes.
Demo survivability
Spencer Kimball speaking at the CockroachDB SF User Group.
Always-on service

Go cloud-native with a database that supports flexible deployment

  • Take full advantage of the horizontal scalability and flexibility of the cloud with symmetric nodes that run on commodity hardware.
  • Control data placement with zone configurations for faster client response times, better performance, and stronger availability.
Explore deployment options
CockroachDB admin dashboard
Flexible Operations

Simplify operations with built-in scaling and replication

  • Reduce operational overhead with self-organizing nodes that support built-in scaling, failover, replication, and repair.
  • Maintain enterprise-grade infrastructure with zero downtime rolling upgrades.
  • Monitor cluster health and performance through the admin UI.
Learn more
A person sitting happily at a desktop work station.
Expert support

Run confidently with enterprise-grade support

  • Connect directly with engineers for comprehensive debugging and resolution.
  • Collaborate for customized advice on performance and deployment strategies.
  • Access 100% of source code in order to build plug-ins to integrate with your existing tools.
Explore developer resources
Trusted by customers, everywhere

“CockroachDB significantly reduces the operational complexity that comes with scale, without forcing us to sacrifice the relational database features we rely on to build important applications. CockroachDB is very easy to deploy, making it an ideal choice for running in the cloud.” - Baidu DBA team

Read their story