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.)
CockroachDB is inspired by Google’s Spanner and F1 to address fault tolerance and distributed consistency.
Transactions in CockroachDB is implemented
CockroachDB supports primary key and secondary key indexes using B+Trees. The indexes are implemented with the distributed key-value store ranges.
CockroachDB supports snapshot isolation (SI) and serializable snapshot isolation (SSI). It is implemented using RocksDB snapshot capability.
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.
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.
CockroachDB aims to provide standard SQL with extensions, but some standard SQL functionality is under development.
The backend storage in CockroachDB is RocksDB. It is disk-oriented storage.
CockroachDB stores its data in the distributed key-value store.
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.
Commercial, Open Source
Linux, OS X, Windows