Commit

c852d9a

A query with WHERE tenant_id = ? AND status = 'active' ORDER BY created_at DESC LIMIT 20 will still trigger an expensive Using filesort in MySQL if your index only covers (tenant_id, status). Appending created_at to the end of that composite index lets InnoDB read the top 20 rows straight in index order and stop.

commit c852d9a