Support a filter plus order-by pattern.
Section: MySQL index patterns
Create a composite index
sql
sql
CREATE INDEX idx_orders_status_created_at ON orders (status, created_at DESC);Explanation
Descending indexes can help mixed sort-order workloads and order-sensitive queries in modern MySQL.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing MySQL index patterns
Create an invisible index
Test an index without making it visible to the optimizer by default.
Refresh table statistics
Help the optimizer make better choices after major data changes.