• JJ B,

    Many thanks for your post and kind comments.

    It's certainly been a valuable process for me to discover the performance limitations of ROW_NUMBER(), and be able to demonstrate that they can be overcome with appropriate indexing strategies.

    However, it's clear that any ROW_NUMBER() based solution across large amounts of data does have some gotchas. Should the "ideal" index(es) not be available, or can't be created due to environmental constraints, other solutions are faster.

    As always, it's about understanding your data and the queries that are run across it.

    Kind regards,

    Lawrence