PlanetScale

Why isn’t MySQL using my index?

May 4, 2023Aaron Francis
Why isn’t MySQL using my index?
SummaryAI, from the source post

This post provides a deep dive into common reasons why MySQL might not use an index, even when one is defined. It explains how to use `EXPLAIN` to diagnose index usage, discusses index selectivity and cardinality, and highlights the impact of outdated statistics. It also covers index limitations, such as wildcard searches and applying functions to indexed columns, and explains scenarios where a table scan might be faster than using an index. The post uses a concrete `people` table example to illustrate these concepts.

More from the MySQL Database Design Best Practices trail