01Chapter 1: Why indexes exist: pages and the cost of I/OThis chapter assumes you know basic SQL (SELECT, WHERE, CREATE TABLE) and have a rough idea of binary search and trees. You should also know that a database stores its data on disk and reads it in blocks. Nothing else is needed.3 min read
02Chapter 2: From binary search to the problem with binary treesThis chapter assumes you know basic SQL, how binary search works on a sorted array, and what a tree is. It also assumes you know that disks are read in blocks (pages), which the previous chapter covered. Here you will see why binary search is the right idea but a binary tree is the wrong shape for d3 min read
03Chapter 3: B-tree structure: nodes, order, and fanoutThis chapter assumes you know basic SQL, can read short Python, and understand binary search on a sorted array. It also assumes you know that a database reads disk data in fixed-size blocks called pages. The previous chapters covered why page reads dominate index cost and why binary trees fit disks 3 min read
04Chapter 4: Searching a B-treeThis chapter assumes you know binary search on a sorted array and what a B-tree node looks like: a sorted list of keys and, in internal nodes, one more child pointer than keys. Searching a B-tree combines two steps at each node: a binary search among the node's keys, then a jump to one child.3 min read
05Chapter 5: Inserting keys and splitting nodesThis chapter assumes you know how a B-tree search works (binary search inside a node, then follow one child pointer) and what a page is. Here you will see what happens when a key lands in a node that has no room left.2 min read
06Chapter 6: Deleting keys: borrowing and mergingThis chapter assumes you know how a B-tree is laid out and searched, and how an insert splits a full node. Deletion is the mirror image of that. Inserts fix overfull nodes by splitting. Deletes fix underfull nodes by borrowing or merging.3 min read
08Chapter 8: Clustered and secondary indexesThis chapter assumes you know basic SQL, how a B+tree keeps entries in linked leaf pages, and why a lookup reads only a few pages. Here you will see what the leaf pages of an index actually hold, and why that changes the cost of a lookup.3 min read
09Chapter 9: Composite indexes and column orderThis chapter assumes you know basic SQL, understand that a B+tree keeps entries sorted, and know that a lookup descends from the root to a leaf. It covers how a multi-column index is ordered and how to choose the column order.2 min read
10Chapter 10: Covering indexes and index-only scansThis chapter assumes you know how a B+tree index maps keys to row locations, the difference between clustered and secondary indexes, and how composite indexes are ordered by column. It builds on those ideas.3 min read
11Chapter 11: Checking index use with EXPLAINThis chapter assumes you know basic SQL, have read the earlier chapters on B+trees, composite indexes, and covering indexes, and use PostgreSQL. Other databases have an EXPLAIN command too, but the output format and node names differ.2 min read
12Chapter 12: Fill factor, fragmentation, and index bloatThis chapter assumes you know how B+tree pages split on insert and merge on delete, and that you can read a basic EXPLAIN plan. It covers how an index's physical state drifts from its ideal shape and what you can do about it.3 min read
13Chapter 13: Concurrent access and crash safetyThis chapter assumes you know how a B-tree search and a node split work, and that you have used basic SQL. It covers two questions. How do many sessions use one index at the same time? How does an index survive a crash in the middle of a split?3 min read
14Chapter 14: B-trees versus LSM-treesThis chapter assumes you know how a B+tree is searched, how inserts cause page splits, and what write amplification means at a basic level (one logical write causing several physical writes). It compares the B-tree design with the log-structured merge-tree (LSM-tree), the other common way to store a3 min read