liveBook · Manning

Indexing

As explained in Grokking Software Architecture

The creation and maintenance of auxiliary structures that help a database locate records efficiently.

A database without an index may scan every row to find one record, like reading a phone book cover to cover. An index gives it a sorted lookup structure to find the record and jump to its location. section 8.5.1

A B-Tree keeps data sorted in balanced, hierarchical blocks. It lets the database skip irrelevant records while supporting searches, sequential access, insertions, and deletions. section 8.5.1

Indexes trade faster reads for slower writes: each INSERT, UPDATE, or DELETE may require maintaining the index. Add indexes to support useful lookups, not automatically to every column. section 8.5.1

Figure 8.10 Indexing: An index allows the database to jump directly to the data instead of scanning every single row.

See how an index lets the database jump to a record instead of scanning every row. section 8.5.1

Figure 8.11 The Tradeoff: Indexes speed up reads (finding the file) but slow down writes (you have to file the paper in multiple places).

Compare faster reads with the extra work indexes add to writes. section 8.5.1

How Grokking Software Architecture covers it

How deep it goes
Defines B-Trees and write penalties, then explains lookup and maintenance tradeoffs without detailing index implementation.
Examples
Uses a phone-book lookup for an email address and filing papers in multiple folders to illustrate read and write costs.
What it assumes
Assumes structured database data and introduces indexing through row lookups and physical performance constraints.
What you can do after
Evaluate whether faster lookups justify the write cost of maintaining indexes.
How it connects
Connects indexing to B-Trees, full table scans, and INSERT, UPDATE, and DELETE operations.

Also explained in

Compare how 22 books explain indexing →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.