Hash Indices.png

Difficulty: Advanced

Reading Time: 35 min read

Last Updated: September 01, 2025


Why Hash Indices?

In the last articles, we explored Ordered Indexes and the B+-Tree, which organize data based on search-key values. Their strength lies in range queries and maintaining a sorted structure: you can efficiently find "all products between Coffee and Laptop" because the order is preserved.

But sometimes, order doesn’t matter.

If your goal is simply:

Then, traversing a multi-level tree structure is overkill. What you need is direct access, like looking up a word in a dictionary using its first letter and page number.

That’s where Hash Indexes come in.

Hashing transforms a search key (e.g., a ProductID or Name) into a bucket address using a hash function. Instead of walking down levels of a tree, the DB can jump directly to the location where the record should be.

In this article, we’ll dive into: