Get the column order right on a composite index
bookings is filtered constantly by route, and about half of those queries add a second filter on status. Nothing ever filters by status alone. Create one composite index that serves both query shapes — filtering on route alone, and filtering on route AND status together — as efficiently as a single index can.
Column order in a composite index isn't arbitrary: an index on (a, b) can be used for a query that filters on a alone, but is far less useful for a query that filters on b alone. Put the columns in the order that matches how these queries actually filter.
Schema
| id | INT |
| route | TEXT |
| status | TEXT |
| fare | NUMERIC |
Example input
Stuck? Ask the coach for a nudge that won't give the answer away, or reveal the reference solution and a short walkthrough of why it works.