Lakshay
Databricks Employee
Databricks Employee

Hi @Matthew Elsham​ , In this case, I would expect the window functions to do better because you are doing 2 joins in the second query.

With that being said, the performance of joins is highly dependent on the type of join strategy and the volume of data to be joined. But window functions will give you much cleaner code to work with.