Order matters; covering avoids the heap.
Composite and Covering Indexes: order matters
shape data so reads and writes stay honest
Covering increases write/storage cost.
Composite indexes serve queries that filter on a prefix of their column list. Covering indexes include extra non-key columns so the query can be answered without touching the table.
Leftmost prefix: index (a,b,c) supports queries on a, a+b, a+b+c — not on b alone.
Order columns by selectivity and equality vs range; equality cols first.
Covering indexes: pay storage for read-only speed.
Pagination by (user_id, created_at) with id tiebreaker.