Describe a time you had to optimize a slow-performing query or API endpoint. What steps did you take?