CockroachDB (sometimes shortened as CRDB) is a free and open source distributed SQL database built on a transactional and strongly-consistent key-value store. It is backed by PebbleDB (a RocksDB/LevelDB-inspired KV store) and uses the Raft distributed consensus algorithm to ensure consistency.[05][06]
- Source Code
- https://github.com/cockroachdb/cockroach[02]
- @CockroachDB
- Developer
- Country of Origin
- US
- Start Year
- 2014 [20]
- Project Types
- Commercial, Open Source
- Written in
- Go
- Supported Languages
- Go
- Derived From
- RocksDB
- Embeds / Uses
- Pebble
- Inspired By
- Cloud Spanner
- Compatible With
- PostgreSQL
- License
- Business Source License
CockroachDB (sometimes shortened as CRDB) is a free and open source distributed SQL database built on a transactional and strongly-consistent key-value store. It is backed by PebbleDB (a RocksDB/LevelDB-inspired KV store) and uses the Raft distributed consensus algorithm to ensure consistency.[05][06]
History[07][08][09]
CockroachDB is inspired by Google’s Spanner and F1 to address fault tolerance and distributed consistency.
Isolation Levels[05][14][15]
CockroachDB supports Serializable isolation and Read Committed isolation.
Joins[16]
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.
Query Compilation
CockroachDB implements a MonetDB/X100 style vectorized execution engine, which compiles queries into a tree of monomorphized query execution operators.
Query Execution[17]
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.
Query Interface[18]
CockroachDB aims to provide compatible PostgreSQL with extensions, but some standard SQL functionality is under development.
Storage Architecture[05]
The backend storage in CockroachDB is Pebble, a native Go version of RocksDB. It is disk-oriented storage.
System Architecture[05]
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.
Citations
23 sources- CockroachDB | Distributed SQL for always-on customer experiences cockroachlabs.com
- GitHub - cockroachdb/cockroach: CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement. · GitHub github.com
- CockroachDB Docs cockroachlabs.com
- CockroachDB - Wikipedia wikipedia.org
- cockroach/docs/design.md at master · cockroachdb/cockroach · GitHub github.com
- GitHub - cockroachdb/pebble: RocksDB/LevelDB inspired key-value database in Go · GitHub github.com
- CockroachDB FAQs cockroachlabs.com
- Spanner: Google’s Globally-Distributed Database | USENIX usenix.org
- F1 - The Fault-Tolerant Distributed RDBMS Supporting Google's Ad Business research.google
- Foreign Key Constraint cockroachlabs.com
- https://pkg.go.dev/github.com/cockroachdb/cockroach/sql?utm_source=godoc go.dev
- https://github.com/cockroachdb/cockroach/blob/master/storage/scanner_test.go github.com
- SQL in CockroachDB: Mapping table data to key-value storage cockroachlabs.com
- cockroach/storage/replica_raftstorage.go at 266e50907fbc7b0769ab6afd10892b16cc02c371 · cockroachdb/cockroach · GitHub github.com
- cockroach/storage/engine/rocksdb.go at 5c4631f4b7328764ab150938974766d7e63c746a · cockroachdb/cockroach · GitHub github.com
- https://github.com/cockroachdb/cockroach/blob/master/docs/RFCS/distributed_sql.md github.com
- https://github.com/cockroachdb/cockroach/blob/master/docs/RFCS/distributed_sql.md#execution-infrastructure github.com
- https://www.cockroachlabs.com/docs/learn-cockroachdb-sql.html cockroachlabs.com
- https://pkg.go.dev/github.com/cockroachdb/cockroach/storage?utm_source=godoc go.dev
- About cockroachlabs.com
- https://github.com/cockroachdb/cockroach/commit/97f69faeeb79f03456ce976b56cd79f6e5fd386c github.com
- https://github.com/cockroachdb/cockroach/commit/b008cc81959aa2b96b045aec4327f061b875ffd1 github.com
- https://github.com/cockroachdb/cockroach/commit/4e892582067ad760f67defe4eda86923d4fccf96 github.com