FREE LESSON · Databases & data systems · 1 OF 4
How Database Storage and Indexes Work
Records live in pages, not tables — Storage layout and indexes from first principles
The database moves blocks and interprets structure inside them.
Storage engines group records into pages because devices and caches transfer blocks efficiently. A buffer manager keeps useful pages in memory. A heap file offers simple placement; a B-tree keeps keys ordered with balanced, page-sized nodes; a log-structured design turns updates into sequential writes and later compaction.
An index is a second representation that accelerates reads by creating extra write and storage work.
A secondary index needs a route back to the row
An index entry commonly stores the indexed key plus a row locator or primary key. A lookup reads index pages, finds candidate entries, and may fetch table pages to retrieve unindexed columns. A covering index includes everything the query needs, avoiding those extra lookups at the cost of a larger index and heavier writes.
Count page access and write amplification, not just comparison operations.