SQLAdvanced#indexes#performance

Why might an index not be used by a query?

Common causes: wrapping the column in a function, leading wildcard LIKE, implicit type conversion, low selectivity, or a stale optimizer statistic.

Example
-- index unused:
WHERE YEAR(order_date) = 2026
-- index-friendly rewrite:
WHERE order_date >= '2026-01-01' AND order_date < '2027-01-01'

Related Questions

1
SQLIntermediate#subqueries

What is a subquery? Correlated vs non-correlated?

Open
2
SQLIntermediate#subqueries

Difference between IN, EXISTS and JOIN?

Open
3
SQLIntermediate#queries#cte

What is a CTE (Common Table Expression)?

Open