Database Reference
In-Depth Information
SQL Server handles parallelism in row- and batch-mode execution very differently. As you know, in row-based
mode, an
Exchange
operator distributes rows between different parallel threads using one of the distribution
algorithms available. However, after the distribution, a row never migrates from one thread to another until another
Exchange
operator gathers or repartitions the data.
Figure
34-6
illustrates this by demonstrating an
Exchange
operator that uses the
Range
redistribution method to
distribute data to three parallel threads that perform
Hash Joins
. The first letter of a join key value would control to
which thread row it is distributed and where it is processed.
Figure 34-6.
Parallelism in row-mode processing
SQL Server takes a different approach with batch-mode processing. In that mode, every operator has a queue of
work items (batches) to process. Worker threads from a shared pool pick items from queues and process them while
migrating from operator to operator. Figure
34-7
illustrates this method.
Figure 34-7.
Parallelism in batch-mode processing