As asked
Walk me through the most complex slow query you have investigated in production. What were the symptoms, what tools did you use, what did you find, and how did you fix it?
Sample answer outline
A strong answer names the specific database and tools (EXPLAIN ANALYZE, pg_stat_statements, auto_explain, slow query log), describes the misleading symptoms (e.g., query was fast in dev but slow in prod due to data distribution), identifies the root cause (e.g., bad join order, stale statistics, parameter sniffing, missing index), and explains the fix. Bonus: the candidate tested the fix under realistic data volume and monitored for regression.
Expect these follow-ups
- How did you ensure the fix did not regress other queries that used the same index or plan?