An index on order_date is sorted by order_date. A filter can use it only if it asks about order_date itself. Wrap the column in a function and the database has to compute that function for every row:
WHERE EXTRACT(YEAR FROM order_date) = 2025 -- reads every row
WHERE order_date >= '2025-01-01' AND order_date < '2026-01-01' -- can use the index
The second form is called sargable (searchable by argument). The same idea in other shapes:
- Move arithmetic to the constant side:
price > 50 / 1.1, not price * 1.1 > 50.
- Compare with the column's own type:
customer_id = 3, not CAST(customer_id AS VARCHAR) = '3'.
LIKE 'Lin%' can use an index; LIKE '%Lin%' cannot, because the start is unknown.
Columnar engines like the one here, BigQuery and Snowflake skip blocks of data using min and max values per block, and the same rewrites help them for the same reason. The exercises check that your result is right and that the column is left bare.