Lesson 22 / 28
Indexes
Speed up lookups on large tables.
What an index does
An index is a sorted lookup structure on a column — it lets MySQL find matching rows without scanning the whole table.
Like a book's index
Just like a book's index lets you jump to a page instead of reading cover to cover, a database index skips straight to matching rows.
Creating an index
Index columns you frequently filter or join on.
CREATE INDEX idx_orders_customer
ON orders (customer_id);