Databases are frequently blamed for application bottlenecks, yet in 90% of slow response incidents, the culprit is an absent compound index or an unbuffered Cartesian join.
Understanding Index Cardinality
When indexing multi-column queries, the order of columns in your index must match the equality and range filters of your queries. The leftmost prefix rule governs which columns MySQL can utilize.
Leveraging EXPLAIN FORMAT=JSON
Never guess what the optimizer is doing. Using EXPLAIN FORMAT=JSON provides deep insight into index lookups, temporary tables, and sorting passes.