Describe a situation where a query was slowing down the application. How did you find and fix the problem?
This is the single most common MySQL behavioural question, because it maps directly onto the job. Walk through it as an investigation, in order:
- How you noticed. An alert, a user complaint, or a spike in the slow query log — say which.
- How you isolated it.
SHOW FULL PROCESSLISTto see what was running, the slow query log or Performance Schema to find the worst offenders by total time rather than by single-run time. - What EXPLAIN told you. The usual culprits: a full table scan, a missing composite index, an index that could not be used because of a function wrapped around the column, or a bad join order.
- What you changed and what it bought you. Give the before and after number.
Note: Mention that you fixed the worst query by total execution time, not the slowest individual one. A query that takes 200ms and runs 50,000 times an hour costs far more than a 4-second report nobody runs.





