CockroachDB (sometimes shortened as CRDB) is a scalable, fault-tolerant, SQL database built on a transactional and strongly-consistent key-value store. It is backed by RocksDB and uses the Raft distributed consensus algorithm to ensure consistency.
CockroachDB is inspired by Google’s Spanner and F1 to address fault tolerance and distributed consistency.
CockroachDB supports foreign keys.
CockroachDB's indexes are stored in RocksDB's LSM tree implementation.
CockroachDB supports serializable snapshot isolation (SSI). It is implemented using RocksDB snapshot capability.
CockroachDB supports all standard SQL joins. Distributed joins are performed via a shuffle by hash strategy, or a batched nested loop strategy. Broadcast joins are not supported.
CockroachDB supports distributed SQL execution. The gateway query node is responsible for creating a DAG of SQL processors and distributing them across the cluster, like in F1. The individual SQL processors operate in either a tuple-at-a-time mode, which supports all SQL queries in CockroachDB, or a vectorized mode, which supports a subset of SQL, depending on query cardinality.
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.