Composite index

An index on more than one column, sorted by the first column, then by the second within equal first values, and so on. Column order decides which queries it can serve.

Minimal example

sql
INDEX idx_rest_geo (lat, lng)

Learn this concept

Lesson 2.1 · MySQL tables, keys and InnoDB indexes

Used in exercises

Exercise 2.3 · Write the restaurant and menu migrations Exercise 2.6 · Generate the restaurant and menu queries Exercise 2.26 · GET /v1/restaurants: sort by distance Exercise 3.6 · Migration 0006: order tables Exercise 6.12 · Find and fix the first bottleneck
Prerequisite conceptsSecondary index