Databases & Data Storage

B-Tree

Definition

A B-tree is a self-balancing tree data structure that maintains sorted data and allows searches, sequential access, insertions, and deletions in logarithmic time. The B-tree is a generalization of a binary search tree in that a node can have more than two children.

Why It Matters

B-trees are the classic and most widely used data structure for implementing database indexes. Their structure is optimized for systems that read and write large blocks of data, making them a perfect fit for disk-based storage.

Contextual Example

When you create an index on a table column, the database will typically build a B-tree data structure behind the scenes. This tree allows it to quickly navigate to the data you are looking for without scanning the whole table.

Common Misunderstandings

  • B-trees are "balanced," which means they have a similar number of records in each branch, ensuring that lookups are consistently fast.
  • Most modern database systems use a variant called B+ tree for their indexes.

Related Terms

Last Updated: December 17, 2025