One index, many columns
A composite (multi-column) index is a single B-tree where keys are concatenated. CREATE INDEX ... ON orders (customer_id, placed_at DESC) sorts first by customer_id, then by placed_at within each customer. This is what makes "give me Alice's most recent 5 orders" instant.
Column order matters
A composite index on (a, b, c) can serve queries filtering on:
aalonea + ba + b + c
It cannot serve queries filtering only on b or only on c — those need their own indexes. The leading column is the gatekeeper.
The classic shape: equality first, range last
For WHERE customer_id = 7 AND placed_at >= '2026-04-01', the optimal composite is (customer_id, placed_at) — equality first, range last. Reverse it and the planner can't use both columns to narrow the range.