Skip to content

Community Q&A & Discussions

← Back to Forum

Question & Answer

Understanding B+ Tree Indexing vs. Hash Indexing in Relational Databases

By Sourav Adhikary · Published on October 7, 2026

In relational database engines like MySQL (InnoDB) and PostgreSQL, B+ Trees are heavily preferred over Hash indexes for primary keys and range queries.

Why does B+ Tree perform significantly better for range scans (e.g. WHERE age BETWEEN 20 AND 30) compared to Hash indexes?

Mentor & Peer Replies

Dr. Sourav Adhikary

B+ Trees maintain sorted key structures across leaf nodes linked together in a doubly-linked list. This enables O(log N) point lookup followed by sequential O(K) leaf node traversal for range scans. Hash indexes, while providing O(1) point lookups, do not preserve key ordering and force full bucket table scans for range queries.

Sign in to reply.