Home▸Articles▸Computer Science

Database Index Page-I/O Lab: B+ Tree Height, Hash Probes and the Index-vs-Scan Crossover

Understanding how database indexing works is crucial for optimizing query performance in large datasets.

mysimulator teamUpdated June 2026≈ 3 min read▶ Open the simulation

What Is a Database Index?

A database index is a data structure that improves the speed of data retrieval operations on a database table. It works by storing pointers to the actual data, allowing for faster access compared to scanning the entire table.

The B+ tree and hash tables are two common types of indexes used in databases.

B+ Tree Height and Fanout

The height of a B+ tree is determined by its fanout, which is the number of children each node can have. A higher fanout generally means a shorter tree with fewer levels to traverse.

The relationship between fanout and tree height is governed by the formula: height = log(n / m) where n is the total number of keys and m is the minimum number of keys per node.

live demo · related simulation● LIVE

Hash Index Probes

A hash index uses a hash function to map key values to an array of buckets. The number of probes, or collisions, increases as more keys are inserted into the same bucket.

The performance of a hash index can be affected by the load factor (the ratio of the number of stored elements to the total capacity) and the quality of the hash function.

Index-vs-Scan Crossover

The point at which an index lookup becomes more expensive than a full table scan is known as the crossover point. This depends on factors such as the number of rows, the selectivity of the query, and cache effects.

Understanding this concept helps in choosing the most efficient way to retrieve data based on the specific conditions of the database.

Frequently asked questions

What is a B+ tree fanout?

B+ tree fanout refers to the maximum number of children each node can have, which directly influences the height and performance of the tree.

How does cache affect page reads in database indexing?

Cache effects on page reads mean that frequently accessed pages are likely to be stored in memory, reducing the time needed to retrieve data from disk.

What is the crossover point in index-vs-scan analysis?

The crossover point is where a full table scan becomes more efficient than using an index for retrieval, depending on factors like query selectivity and cache usage.

Why are hash probes important in database indexing?

Hash probes determine the efficiency of hash indexes by measuring how many times keys map to the same bucket, which can lead to performance degradation if not managed properly.

Try it live

Everything above runs in your browser — open Database Index Page-I/O Lab: B+ Tree Height, Hash Probes and the Index-vs-Scan Crossover and change the parameters while it is running. Nothing is installed, nothing is uploaded, the whole model lives in one tab.

▶ Open Database Index Page-I/O Lab: B+ Tree Height, Hash Probes and the Index-vs-Scan Crossover simulation

What did you find?

Add reproduction steps (optional)