CXPACKET and SOS_Scheduler_yeild waits

Samantha r 1,326 Reputation points
2024-02-12T18:44:06.9766667+00:00

Hi All, One of the app query is running slow. When I saw the spid's waitype, it is CXPACKET. After digging further one of the thread is waiting for SOS_SCHEDULER_YIELD. question I have is, except this query nothing else is running at that moment. only small other queries coming and exiting. When I observed the windows task manager, Server CPU usage is under 15% utilization. VM has 32 cpus. Why it is had to wait for SOS_SCHEDULER_YIELD.when it is not a high cpu condition on the server? How to troubleshoot and fix such queries? Regards,
Sam    

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,236 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Erland Sommarskog 98,636 Reputation points
    2024-02-12T22:24:56.5866667+00:00

    Exactly what are you looking at? The wait time or numbers of waits? It's quite normal to have a high number of SOS_SCHEDULER_YIELD waits when you have a CPU-intensive process. This is because all code in SQL Server voluntary yields after around 4 ms to permit other tasks to run. But if there is free CPU, the wait should be very short.

    1 person found this answer helpful.