How to debug a slow SQL query
A careful workflow from the symptom to evidence, a testable hypothesis and verification.
TuningLens knowledge base
Direct answers for developers investigating MySQL and MariaDB SELECT queries. Each guide states its version scope, cites primary documentation and treats every recommendation as a hypothesis to verify.
A careful workflow from the symptom to evidence, a testable hypothesis and verification.
Read access paths, indexes, row estimates, joins and Extra without overclaiming what a plan proves.
Understand that it executes the statement and plan a safer diagnostic run.
Reason about leftmost prefixes, equality, ranges, ordering and verification.
Learn when a filesort matters and how to test an ordering-index hypothesis.
Use actual execution statistics with the right safety and version caveats.
See how the process applies to an order-history query and a deep-pagination query. These examples are illustrative and make no measured speedup claims.