Fun fact - Yes, most databases use B+ trees to

Arpit Bhayani

Arpit Bhayani

Jun 18, 2025 • 1 min read


Fun fact - Yes, most databases use B+ trees to hold data, but these trees are not actually very deep; most of them are hardly 3 to 4 levels deep.

A page size is either 4 KB or 8 KB, and a typical B+ tree has a branching factor of 300-500 for a page size of 8 KB. This implies that for a 4-level B+ tree, the total number of leaf nodes will be

Level 1 - 1 Level 2 - 400 Level 3 - 400 * 400 Level 4 - 400 * 400 * 400 = 64M leaf nodes

Each of the 64M leaf node points to a page of size 8KB holding the actual row. Now, assuming each row is 100B long, each leaf node can hold 80 database rows.

With this as our core assumption, the total number of rows this B+ tree can hold is 64M * 80 = 5.12 billion rows. Pretty neat :)

We can thus fairly assume that a typical database would not take more than 3 or 4 page reads to locate any record and then a couple more lookups to read the data stored in the heap.

Hope this helps.

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