• I checked this up and yes, the tables which are used in the CTE definition (very first query in my first post) are partitioned. The partition is on a column BatchID. This column appears in the ON clause of a JOIN in the CTE.

    https://sqlroadie.com/