midMySQL
Debugging with EXPLAIN
Updated May 4, 2026
Short answer
Shows the execution plan the optimizer chose for a query.
Deep explanation
It reveals whether indexes are being used, the order of joins, and the estimated row scans. Essential for SQL tuning.
Real-world example
Checking if a query is doing a 'Full Table Scan' on a production database.
Common mistakes
- Ignoring the 'type' column, which tells you how efficient the search is.
Follow-up questions
- What does type 'index' mean?