[Solved] Nested loop join going single-threaded on large table updating all the rows

xhr489 Asks: Nested loop join going single-threaded on large table updating all the rows
I am looking at some code (reporting stored procedure) where some columns on a large table are updated based on a join. The correct indexes are there, but the execution plan shows a single-threaded nested loop join. My guess is that is chooses the nested loop join in order to avoid the sort after the join. But I don’t understand why is does not run in parallel.

I often see this, i.e. that nested loop join is only single-threaded. I cannot figure out why. The estimated cost of the query is larger than “cost threshold for parallelism” on the instance and as far as I have read none of the factors that cause a query to run single threaded are not present (“Parallelism-inhibiting operations”).

The code is like this:

Code:
UPDATE A
  SET A.COL1 = B.COL1
FROM dbo.MyTable A
    INNER JOIN dbo.OtherTable B
         ON A.COL2 = B.COL2 AND A.COL3 = B.COL3;

Version of SQL Server is 2016.

Also I cannot get the actual execution plan since the query runs forever. I either have to drop the index on the A table or force it with a join hint to use a HASH MATCH JOIN. So I cannot see the “reason for not finding a valid parallel plan” in the root node of the execution plan.

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.