Leftmost-prefix rule
A composite index can be used for a query only from its first column onwards, without skipping one. Once a column is used with a range condition, the columns after it no longer narrow the index scan.
Learn this concept
Lesson 2.1 · MySQL tables, keys and InnoDB indexesUsed in exercises
Exercise 2.3 · Write the restaurant and menu migrations Exercise 2.26 · GET /v1/restaurants: sort by distancePrerequisite conceptsComposite index