Can you describe a complex SQL query you optimized, including the techniques you used to improve its performance?

Technical