Index

Module 01 · Database InternalsOne Database, to the Bolt

Which shortcut to build

B-Tree on Disk
B-Tree on Disk · Open board

The shortcut most indexes are: a sorted tree whose leaves point at rows in the table. This lesson is about the other shortcuts Postgres can build, how to pick the right one for a query, and what every one of them costs on the next write.

Before you start. B-Tree on Disk showed what an index is: a second, sorted copy of one column that points back at the table, so a lookup reads a few pages instead of all of them. MVCC & Vacuum showed that an update does not change a row in place; it writes a new version and leaves the old one for vacuum. The sentence that says what set up the bench this lesson runs on, and The Query Planner showed how Postgres chooses between a scan and an index. Here you choose the index.

Continue reading with a plan

The first three lessons of every track are free. This lesson is included with a plan, which unlocks every lesson, board, video, lab and paper for one price.

View plans →Already a member? Sign in

Related paper

Review Database Internals →

Saved in this browser, and to your account when you sign in.