Column order in a composite index

An index on (a, b, c) helps queries that use a, or a and b, but not b alone. Put equality columns first, ranges last.

SQL · Column order in a composite indexAdvanced
ALTER TABLE orders ADD INDEX idx_status_created (status, created_at);

-- uses the index fully: equality first, then a range
SELECT * FROM orders WHERE status = 'paid' AND created_at >= '2026-10-01';

-- cannot use it well: the first column is missing
SELECT * FROM orders WHERE created_at >= '2026-10-01';

SHOW INDEX FROM orders;
indexcompositeleftmostperformance