DB Index Visualizer
See how indexes dramatically speed up database queries. Search for a value and watch the difference between a full table scan and a B-tree index lookup.
5x
📋 Full Table Scan
Checks every row sequentially until found
Rows Scanned 0
I/O Reads
0
I/O Reads = Disk Page Accesses
Databases read data in pages (typically 8KB blocks). Each page holds multiple rows.
In this demo: 1 page = 10 rows
Fewer I/O reads = faster queries, because disk access is slow compared to memory.
Databases read data in pages (typically 8KB blocks). Each page holds multiple rows.
In this demo: 1 page = 10 rows
Fewer I/O reads = faster queries, because disk access is slow compared to memory.
Time 0ms
Reading Page:
🌳 B-Tree Index
Binary search through sorted tree nodes
Nodes Visited 0
I/O Reads
0
I/O Reads = Node Accesses
Each B-tree node is stored in one disk page. Traversing the tree requires reading one page per level.
With 1 million rows, a B-tree only needs ~3-4 page reads vs. 100,000+ for a full scan!
Each B-tree node is stored in one disk page. Traversing the tree requires reading one page per level.
With 1 million rows, a B-tree only needs ~3-4 page reads vs. 100,000+ for a full scan!
Time 0ms
Click "Search" to see the B-tree traversal
How it works
📋 Table Scan
Without an index, the database must examine every single row to find your data. For a table with 1 million rows, that's 1 million comparisons in the worst case. Time complexity: O(n)
🌳 B-Tree Index
A B-tree keeps data sorted in a tree structure. At each node, we eliminate half (or more) of the remaining possibilities. For 1 million rows, we need only ~20 comparisons. Time complexity: O(log n)