Does Parallel Threads Process Equal Rows? – Interview Question of the Week #211

Question: Do parallel workers process equal numbers of rows?

Four sorting channels deliver different-sized walnut heaps into separate compartments

Answer: No. They can process different numbers of rows. A parallel plan shares work, but it does not promise an equal row count for every worker at every operator.

This question came up during a performance health check. The original AdventureWorks query was a straightforward way to inspect the difference:

-- AdventureWorks2025 sample database; actual plan Ctrl+M in SSMS.
SELECT SalesOrderID, SalesOrderDetailID, CarrierTrackingNumber,
       OrderQty, ProductID, SpecialOfferID, UnitPrice,
       UnitPriceDiscount, LineTotal, rowguid, ModifiedDate
FROM AdventureWorks2025.Sales.SalesOrderDetail
ORDER BY UnitPriceDiscount
OPTION (RECOMPILE, MAXDOP 4);

Turn on the actual execution plan with Ctrl+M, execute the query, select a parallel scan operator and open Properties. Expand its actual row counts by thread. The query above uses the current sample-database name and caps this statement at MAXDOP 4. That cap does not force a parallel plan, and RECOMPILE does not clear other queries’ cached plans.

Original Clustered Index Scan properties show zero coordinator rows and unequal counts across eight workers
Original run: workers processed 5,157, 17,726, 18,757, 17,973, 19,099, 17,490, 12,336 and 12,779 rows, totaling 121,317. Thread 0 processed zero at this scan.

Those are the original scan’s counts, not expected values for today’s run. The number of workers and distribution depend on the plan, data, hardware and execution. A serial plan cannot demonstrate per-worker distribution; inspect a real parallel operator rather than assuming the hint guarantees one.

In this SQL Server 2025 run, the parallel Sort processed 121,317 rows over four executions. The properties confirm actual parallel execution; they do not show the per-worker distribution.
In this SQL Server 2025 run, the parallel Sort processed 121,317 rows over four executions. The properties confirm actual parallel execution; they do not show the per-worker distribution.

At a scan, work can be handed to workers as they become ready. Later exchanges may repartition rows by a key or collect rows into a serial part of the plan. Uneven row counts can reflect normal scheduling or data distribution. Rows can also have different processing costs, so unequal counts alone do not prove a performance problem.

The useful answer in an interview is to distinguish the maximum degree, the actual parallel operator, and its runtime row distribution. Look at the actual plan and workload before calling the distribution a bottleneck. Was the per-thread display already part of your plan checks?

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.


Discover more from SQL Authority with Pinal Dave

Subscribe to get the latest posts sent to your email.

Execution Plan, Parallel, SQL Scripts, SQL Server, SQL Statistics
Previous Post
What is Trusted Constraint in SQL Server? – Interview Question of the Week #210
Next Post
What is Consolidation of Index? – Interview Question of the Week #212

Related Posts

1 Comment. Leave new

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.