CockroachDB

CockroachDB is a scalable, fault-tolerant, SQL database built on a transactional and strongly-consistent key-value store. It is backed by RocksDB and uses distributed consensus algorithm to ensure consistency, it is inspired by Spanner wait commit to implement serializable. It is currently in beta. (Because CockroachDB is rapidly changing, so many findings are based on design document, outdated documentation or available code.)

Query Interface

SQL

CockroachDB aims to provide standard SQL with extensions, but some standard SQL functionality is under development.

Joins

Hash Join

Because CockroachDB is backed by key value store. There are two ways of join in CockroachDB, join-by-lookup and stream joins. Join-by-lookup iterate through one table and lookup for it in the other table. Stream joins is an execution plan based on hashing.

Storage Model

Custom

CockroachDB stores its data in the distributed key-value store.

Query Execution

Tuple-at-a-Time Model

The query execution is similar to stream processing. When executing a query, the execution plan is transformed into a DAG, a gateway node orchestrates participating nodes begin processing.

Stored Procedures

Not Supported

Storage Architecture

Disk-oriented

The backend storage in CockroachDB is RocksDB. It is disk-oriented storage.

System Architecture

Shared-Nothing

CockroachDB has two layers, the SQL layer and the storage layer. The SQL layer sits on top of the transactional and strongly-consistent distributed key-value store. In the key-value store, the key ranges are divided and stored in RocksDB and replicated across cluster. It exports structured data API of relational concepts. It exports standard SQL interface at the SQL layer. The SQL layer translates SQL statements into calls to structured data API.

Query Compilation

Not Supported

Website

https://www.cockroachlabs.com/

Developer

https://github.com/cockroachdb/cockroach/graphs/contributors

Start Year

2014

Project Type

Open Source

Supported languages

Go

Operating Systems

Linux, OS X, Windows