How would you optimize a slow-running query on Pluralsight that involves multiple large table joins and window functions?