Guided Notes

Indexes

Speeding up lookups on large tables β€” and what indexes cost.

The full table scan

Slide 1 / 5

Without help, a database answers WHERE customer_id = 42 by reading every row in the table and checking each one β€” a full table scan.

That's fine for a few thousand rows. For hundreds of millions, it's slow β€” and the same query may run thousands of times a day.

An index lets the database skip straight to the matching rows.

← Views