DBMS Topics
B-Tree
Last Updated : 21 May, 2026
A B-Tree Balanced Tree is a self-balancing, sorted tree data structure that maintains sorted data and allows searches, insertions, and deletions in Olog n time. It is des
What is a B-Tree?
A B-Tree (Balanced Tree) is a self-balancing, sorted tree data structure that maintains sorted data and allows searches, insertions, and deletions in O(log n) time. It is designed for efficient disk-based storage where reading a full node (disk block) at a time is optimal.
Proposed by Rudolf Bayer and Edward McCreight in 1970.
B-Tree Properties (Order m)
A B-Tree of order m (also called degree m or maximum degree m) satisfies:
- Every node has at most m children
- Every non-root internal node has at least ⌈m/2⌉ children
- The root has at least 2 children (if it is not a leaf)
- All leaf nodes are at the same level (tree is balanced)
- A node with k children contains k−1 keys
- Data records (or pointers) are stored in ALL nodes (both internal and leaf)
B-Tree Node Structure
Example — B-Tree of Order 3
Search in B-Tree
| 2. If K = Kᵢ | FOUND, return associated data |
| 3. If K < Kᵢ | recurse into child Pᵢ₋₁ |
| 4. If K > all keys | recurse into rightmost child |
| 5. If N is a leaf and K not found | NOT FOUND |
| Example | Search for 50 in tree above |
| Step 1: Root [30|70] | 50 > 30, 50 < 70 → go to middle child [40|60] |
| Step 2: [40|60] | 50 > 40, 50 < 60 → go to middle child [50] |
| Step 3: [50] | found! ✓ |
| Cost | 3 node reads = 3 disk I/Os |
Insertion in B-Tree
| 2. If leaf has space (< m−1 keys) | insert K there |
| Example | Insert 45 into order-3 B-Tree |
| Find position | goes into node [40|60] |
| [40|60] is full | split! |
| Median = 50 | promote 50 to parent |
| Left | [40], Right: [60] |
Deletion in B-Tree
B-Tree Height and Performance
| Minimum height | h_min = ⌈log_m(n+1)⌉ |
| Maximum height | h_max = ⌊log_⌈m/2⌉((n+1)/2)⌋ + 1 |
| Operations | O(log_m(n)) = O(log n / log m) |
B-Tree vs B+ Tree Preview
| Feature | B-Tree | B+ Tree |
|---|---|---|
| Data storage | All nodes (internal + leaf) | Only leaf nodes |
| Internal nodes | Keys + data pointers | Keys only (routing) |
| Leaf nodes | Linked? No | Linked as list ✓ |
| Range queries | Less efficient | Very efficient |
| Space usage per node | Less keys (data takes space) | More keys (routing only) |
| Most used in DBMS | No | Yes (almost universally) |
The key limitation of B-Trees is that data stored in internal nodes reduces the fan-out (number of children per node), making the tree taller. B+ Trees solve this.
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for B-Tree.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this DBMS topic.
Search Terms
dbms, database management system, database notes, sql, unit, tree, b-tree
Related DBMS Topics