Tinker Databases & indexes

by Kondasamy Jayaraman · drawn with Colorfigures by April Zhu

Nothing asked yet.0 pages read · 0 rows read

Chapter 1 of 7

Find one order

Larkspur’s order system keeps every order in one table. Customers wait on the orders page, and the team wants to know why.

This chapter: What does the database do to find a single order?

About this chapter

You will learn

  • How a table is stored as pages of rows
  • A full scan reads every page
  • Why its cost grows with the table

Words you’ll meet

Row
One record in a table: here, one order.
Page
A fixed-size block of rows the database reads in one go: here, 50 orders.
Full scan
Reading every page of a table to find the rows a request wants.

Step 1 of 4

A customer asks about order 1042. With no index, the database checks every : a .

Find order 1042.

The SQL
SELECT * FROM orders WHERE id = 1042;