Skip to main content

CXCONSUMER

Short Description

Occurs with parallel query plans when a consumer thread waits for a producer thread to send rows. This is a normal part of parallel query execution.

Detailed Description

CXCONSUMER waits occur when parallel query plans are running. When a parallel query is called for, the query is broken down into sub-queries and work assigned to each. These sub-queries run in pairs - Producers scan for data and Consumers pass the data on to further stages of the query. Hence if you request a parallelism of 4, it will require 8 threads plus a co-ordinator thread marshalling producers and consumers. CXPACKET and CXCONSUMER waits are seen when the threads are communicating.

How to reduce this wait

In isolation for a single user, parallel query plans can yield fast results - but beware of flooding a server with producers and consumers if you build this into a system with a high number of concurrent users as the thread count can shoot through the roof.

These waits are normally ignored but if you have long running queries and lots of parallel threads waiting on CXCONSUMER in the output from sys.dm_os_waiting_tasks then it may be worth investigating more. Look for skewed distribution of data or unwanted parallelism.

Microsoft Docs - sys.dm_os_wait_stats (Transact-SQL)

sqlskills.com - CXCOMSUMER

Knee-jerk Wait Statistics - CXPACKET

Search online

If this article doesn't have the information you need you can try searching online. Remember, you can contribute suggestions to this page.

DBmarlin Trial