dbaplus Community
Apr 10, 2024 · Databases
How MySQL Chooses the Cheapest Index for COUNT(*) and When It Gets It Wrong
This article examines whether SELECT COUNT(*) causes full‑table scans, explains MySQL’s optimizer cost‑based index selection (including IO and CPU costs), demonstrates with a 100k‑row table how auxiliary indexes are chosen, and shows cases where the optimizer’s estimates mislead performance.
Index CostOptimizer_trace_count
0 likes · 9 min read
