Describe your approach to optimizing a slow-running SQL query that involves multiple heavy joins and aggregations.