Back to Tools

Developer Tool - SQL Server B-Tree Visualizer

Understand how SQL Server indexes work. Explore B-tree structure, see how key size affects tree depth, and simulate index seeks to visualize the I/O cost of finding a row.

Page Size
8 KB
Key + Pointer Size
10 bytes
Keys Per Page
~800
Tree Depth
3 levels
B-Tree Index Structure
Simulate an Index Seek
Click "Run Seek" to see how SQL Server finds a row

Why This Matters

SQL Server stores data in 8KB pages — the smallest unit it can read from disk. When you create an index, SQL Server builds a B-tree where each node is a page.

Keys per page = 8192 bytes / (key size + 6 byte pointer)

Smaller keys = more keys per page = shallower tree = fewer disk reads = faster.

This is why INT primary keys outperform GUID keys. With INT, you can fit ~800 keys per page. With GUID, only ~370. That difference compounds into deeper trees and more I/O for every single query.

A seek traverses the tree from root to leaf — just a few page reads. A scan reads every leaf page sequentially — potentially thousands of reads.

Ask Casey AI

Ask Me Anything

Hi! I'm Casey's AI assistant. Ask me anything about his work, skills, or projects!

10 messages remaining