EXCHANGE Wait Type in SQL Server

EXCHANGE is a wait that occurs during synchronisation inside the query processor’s exchange iterator, the operator that moves rows between threads in a parallel plan. Exchange operators (you see them as Distribute Streams, Repartition Streams, and Gather Streams in an execution plan) are the joints of a parallel query, and threads coordinating at those joints can register EXCHANGE waits.

On modern versions the parallelism coordination story is dominated by CXPACKET and CXCONSUMER; EXCHANGE is an older and rarer sibling from the same machinery.

Is It a Problem?

Treat it exactly like you treat CXPACKET: it is evidence of parallel queries running, not proof of a problem. Parallelism is desirable for genuinely large work. It becomes a signal when it climbs high in the wait profile of a workload that should not be running big parallel queries in the first place, an OLTP box where short transactions dominate.

Skew makes it worse: if one thread gets most of the rows, the others wait at the exchange for it to finish.

Common Causes

  • Large parallel scans and joins doing legitimate reporting or batch work.
  • cost threshold for parallelism left at the default of 5, letting trivial queries go parallel on modern hardware.
  • Uneven work distribution across threads from stale statistics or naturally skewed data.
  • Missing indexes turning what should be a seek into a big parallel scan.

What To Do

  1. Identify the queries running in parallel: sys.dm_exec_query_stats filtered to plans with max_degree_of_parallelism > 1, ordered by elapsed time.
  2. Raise cost threshold for parallelism to 25 to 50 so only genuinely expensive queries parallelise.
  3. Set MAXDOP sensibly for the box (per NUMA node guidance), rather than leaving it unlimited.
  4. Fix skew at the source: update statistics, and index the predicates driving the big scans.

How To See It

Rank it against everything else with Get-WaitStatistics. Read EXCHANGE together with CXPACKET and CXCONSUMER; they describe the same parallelism story.


Part of the SQL Server Wait Types Library.
Related deep dive: CXPACKET and CXCONSUMER Wait Types.

Comments

Leave a Reply

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