You need to perform a complex SQL query to transform data in an Amazon Redshift cluster. The query involves multiple joins, aggregations, and a window function. Which of the following strategies would you use to structure the query for optimal performance?