1 Indexes & performance
An index speeds up lookups on a column at the cost of slower writes and extra storage. Index columns used in WHERE, JOIN and ORDER BY.
CREATE INDEX idx_orders_user ON orders (user_id);
-- now this lookup can use the index
SELECT * FROM orders WHERE user_id = 42;