CockroachDB Internals ] Data Structures and Algorithms are crucial in

Arpit Bhayani

Arpit Bhayani

Apr 12, 2023 • 2 min read


[CockroachDB Internals #3] Data Structures and Algorithms are crucial in the real world and here’s an example ⚡

CockroachDB, a highly available Distributed SQL database, uses a variety of Data Structures and algorithms to provide guarantees. Here are a few of them

  1. B+ Trees: CockroachDB uses B+ trees to index its data and provide efficient access to it. The B+ trees are used to organize the data on disk and provide fast lookup and range queries.

  2. Raft consensus algorithm: CockroachDB uses the Raft consensus algorithm to ensure consistency and availability of data across multiple nodes in a cluster.

  3. Distributed hash tables: CockroachDB uses distributed hash tables to route data to the appropriate nodes in the cluster. Each node in the cluster is responsible for a portion of the hash table, which allows for efficient data distribution and retrieval.

⚡ Out of these 3, I have explained 2 on my YouTube Channel, give it a watch and subscribe

  1. Why do databases use B+ Trees - youtu.be/09E-tVAUqQw
  2. Kademlia - a Distributed Hash Table - youtu.be/_kCHOpINA5g

⚡ Recently, I started diving deep into CockroachDB internals and will share my learning in public. So, if you find it amusing, follow along.

Arpit Bhayani

Principal Engineer II at Razorpay - building Agent Studio, Ex-staff engg at GCP Memorystore & Dataproc, Creator of DiceDB, ex-Amazon Fast Data, ex-Director of Engg. SRE and Data Engineering at Unacademy. I spark engineering curiosity through my no-fluff engineering videos on YouTube and my courses