Parallel range-based scans are used for the merge process in merge joins.
When two tables are merged in parallel, each worker process is assigned a range of values to merge. The range is determined using histogram statistics or sampling. When a histogram exists for at least one of the join columns, it is used to partition the ranges so that each worker process operates on approximately the same number of rows. If neither join column has a histogram, sampling similar to that performed for other parallel sort operations determines the range of values to be merged by each worker process.
Figure 25-5 shows a parallel right-merge join. In this case:
A right-merge join is used. Table1, the outer table, is scanned into a worktable and sorted, then merged with the inner table. These worker processes are deallocated at the end of this step.
The outer table has two partitions, so two worker processes are used to perform a parallel partition scan.
The inner table has a nonclustered index on the join key. max parallel degree is set to 3, so 3 worker processes are used.