Describe a time when you had to optimize a slow-running query. What steps did you take to diagnose the bottleneck?