Build what you dream.

Never worry about your database again.

/* CockroachDB is the world’s most evolved cloud SQL database —  giving all of your apps effortless scale, bulletproof resilience and low latency performance for users anywhere. */

Scale fast.
Survive anything.
Thrive everywhere.

Scale infinitely without any painful sharding. Use a platform that grows effortlessly from a single customer to massive success.

Learn More

Avoid outages and downtime. Reduce RPO/RTO to zero and keep every user happy.

Learn More

Ensure low-latency data access and comply with data regulations by instantly deploying anywhere in the world.

Learn More

Optimize where your data lives and maximize fault-tolerance by deploying across multiple clouds, public and private with CockroachDB Self-Hosted.

Use a language you already know and tools you already love with Postgres-compatible SQL syntax.

Learn More

Learn from free tutorials and courses, and work with a team of experts 24x7 who are committed to your success.

Learn More

Free yourself from hassle with a fully-managed database service. Get exactly the resources you need and pay only for what you use.

Learn More

Get started for free, instantly.

/* No credit card required. Free up to 5Gb. Single-click deployment.*/

The cloud database
built for you


A feature-set designed for developer productivity.

Start instantly

Connect to the connection string and start building

Pay as you go

Only pay for the exact resources your app uses

Build, don’t operate

Eliminate manual tasks with auto-scaling

Use relational schema

Don’t sacrifice consistency or familiarity

Make online schema changes

Change schema with zero downtime in production

Use PostgreSQL drivers & ORMs

Use your favorite stack and third-party tools

• • •

conn = psycopg2.connect(

def create_accounts(conn):
    with conn.cursor() as cur:
            "CREATE TABLE IF NOT EXISTS accounts (id INT PRIMARY KEY, balance INT)"
        cur.execute("UPSERT INTO accounts (id, balance) VALUES (1, 1000), (2, 250)")
        logging.debug("create_accounts(): status message: %s", cur.statusmessage)

def delete_accounts(conn):
    with conn.cursor() as cur:
        cur.execute("DELETE FROM bank.accounts")
        logging.debug("delete_accounts(): status message: %s", cur.statusmessage)


public static void main(String[] args) {
    // Configure the database connection.
    PGSimpleDataSource ds = new PGSimpleDataSource();
    ds.setReWriteBatchedInserts(true); // add `rewriteBatchedInserts=true` to pg connection string

    // Set up the 'accounts' table.

    // Insert a few accounts "by hand", using INSERTs on the backend.
    int updatedAccounts = updateAccounts();
    System.out.printf("BasicExampleDAO.updateAccounts:\n    => %s total updated accounts\n", updatedAccounts);

public static void createAccounts(PGSimpleDataSource ds) {
    String sql = "CREATE TABLE IF NOT EXISTS accounts (id INT PRIMARY KEY, balance INT, CONSTRAINT balance_gt_0 CHECK (balance >= 0))";
    try (Connection connection = ds.getConnection()) {

public static int updateAccounts(PGSimpleDataSource ds) {
    String sql1 = "INSERT INTO accounts (id, balance) VALUES (1, 1000)";
    String sql2 = "INSERT INTO accounts (id, balance) VALUES (2, 250)";
    try (Connection connection = ds.getConnection()) {

func main() {
    config, err := pgx.ParseConfig("postgresql://maxroach@localhost:26257/bank?sslmode=require&sslrootcert=certs/ca.crt&sslkey=certs/client.maxroach.key&sslcert=certs/client.maxroach.crt")
    if err != nil {
        log.Fatal("error configuring the database: ", err)
    config.TLSConfig.ServerName = "localhost"
    // Connect to the "bank" database.
    conn, err := pgx.ConnectConfig(context.Background(), config)
    if err != nil {
        log.Fatal("error connecting to the database: ", err)
    defer conn.Close(context.Background())
    // Create the "accounts" table.
    if _, err := conn.Exec(context.Background(),
        "CREATE TABLE IF NOT EXISTS accounts (id INT PRIMARY KEY, balance INT)"); err != nil {
    // Insert two rows into the "accounts" table.
    if _, err := conn.Exec(context.Background(),
        "INSERT INTO accounts (id, balance) VALUES (1, 1000), (2, 250)"); err != nil {

# Connect to the "bank" database.
conn = PG.connect(
  user: 'maxroach',
  dbname: 'bank',
  host: 'localhost',
  port: 26257,
  sslmode: 'require',
  sslrootcert: 'certs/ca.crt',
  sslkey: 'certs/client.maxroach.key',
  sslcert: 'certs/client.maxroach.crt'

# Create the "accounts" table.
conn.exec('CREATE TABLE IF NOT EXISTS accounts (id INT PRIMARY KEY, balance INT)')

# Insert two rows into the "accounts" table.
conn.exec('INSERT INTO accounts (id, balance) VALUES (1, 1000), (2, 250)')


A database that delivers on the promises of the cloud.

Grow without pain

Embrace a platform that scales with your applications

Support transactions at scale

Eliminate manual tasks with auto-scaling

Deliver an exceptional experience

Customize your database’s survival and latency goals

Serve a global user-base

Deploy across multiple cloud regions around the globe

Learn more
about CockroachDB


Access tutorials, guides, example applications, and much more.

Read Docs


Look under the hood and understand how CockroachDB works.

Learn more

Customer Stories

Read how companies support their most important workloads.

CockroachDB in action

Deploy CockroachDB
your way

• • •

CockroachDB Dedicated

/* Ideal deployment for a cloud database */

• Fully managed service
• Dedicated, single-tenant hardware
• Flexible configurations
• Storage and compute-based pricing

Contact Us

CockroachDB Serverless BETA

/* Great for starter projects and evaluation */

• Fully managed service

• Shared, multi-tenant hardware

• Auto-scaling

• Consumption-based pricing

Get started for Free

CockroachDB Self-hosted

/* For teams that need to use their own infrastructure */

• Self-managed

• Can run in any cloud or on-prem

• Enterprise license available

Get started for Free