CockroachDB review: A scale-out SQL database built for survival

CockroachDB is a distributed SQL database built on top of a transactional and consistent key-value store that can withstand datacenter failures

1 2 Page 2
Page 2 of 2

Like Google Cloud Spanner, Oracle Database, and Microsoft SQL Server, CockroachDB supports historical data queries, also known as time travel queries. These can only go as far back as the most recent garbage collection, however.

In the Enterprise SKU, V1.2 features will include geo-partitioning, role-based access control, point-in-time restore, and per-store encryption at rest. Partitioning enables a whole class of use cases, such as keeping European data in Europe to comply with EU regulations. Partitioning also solves the cluster distribution versus performance problem, because rows with a given region code can be restricted to nodes in that region even if the cluster is global.

CockroachDB vs. Spanner

I think about CockroachDB primarily as a competitor to Google Cloud Spanner, except that CockroachDB is open source and not yet available as a service, while Cloud Spanner is proprietary and only available as a Google service. Both databases offer SQL compatibility, relational schemas, ACID transactions, and consistency, along with the scalability one expects from a NoSQL database. Cloud Spanner relies on highly accurate TrueTime, atomic clocks, GPS satellites, and Google’s file system. CockroachDB makes do with less-accurate NTP time and whatever file system you want to mount it on.

At the SQL level, Spanner has been fully tuned for excellent performance, but has a much different way of doing data manipulation than most databases. Porting an existing database and associated applications to Spanner would take some real work. CockroachDB has not yet had its SQL join performance tuned, but its SQL dialect is pretty much standard, as far as it goes.

You could also compare CockroachDB to PostgreSQL, the database with which it is most compatible at the SQL level. There again CockroachDB suffers from a lack of SQL join performance work, but can scale like nobody’s business. PostgreSQL has great SQL performance but can’t easily scale horizontally without something like Citus, which is not cheap. CockroachDB 1.1 is still missing some major features of PostgreSQL for specific applications: JSON data, geographical indexing, row-level cascades, and triggers, for example. If you’re thinking of porting a database and application from PostgreSQL to CockroachDB, you will need to do some planning.

Let me say once again that CockroachDB 1.1 isn’t ready for applications that make heavy use of complex SQL joins. It also isn’t ready for heavy analytics or OLAP. Give it a year, though. Cockroach Labs is working hard on those.

You could compare CockroachDB Enterprise with Oracle RAC, as well. According to Cockroach Labs, the license cost per CPU of a fully supported CockroachDB cluster is usually around 10 percent of the license cost per CPU of Oracle RAC. In addition, CockroachDB Core is free open source that runs on almost any environment.

Basically, CockroachDB is an unusually affordable and flexible way to gain strongly consistent OLTP across geographically distributed servers, but your requirements will determine whether CockroachDB 1.1 is far enough along now to serve all your distributed database needs.

Cost: Core: Free. Enterprise: 30-day free trial, pricing based on number of CPUs, with discounts based on the type of usage and support.

Platform: MacOS, Linux, or (for development) Windows. Can be deployed on public cloud, private cloud, container, VM, or bare-metal server.

At a Glance
  • CockroachDB is a distributed SQL database built on top of a transactional and consistent key-value store. It is designed to survive disk, machine, rack, and even datacenter failures with minimal latency disruption and no manual intervention.

    Pros

    • Strongly consistent OLTP across geographically distributed nodes
    • Horizontally scalable for writes as well as reads
    • Open source
    • Does not require GPS or atomic clocks
    • Available on most clouds and platforms

    Cons

    • Limited optimization of SQL JOIN queries
    • Not yet available as a fully managed service
    • Does not yet support JSON or Protobuf data types

Copyright © 2018 IDG Communications, Inc.

1 2 Page 2
Page 2 of 2