5

I need to understand below behavior of sql server queries

System has 4 CPUs with hyper thread ratio of 20 making 80 logical processors count on my sql server instance.

Currently MAXDOP is 0 and ctop is 5

This is a read only instance acting as stand by for LS where all reporting is done.

Lot of queries coming in seems to show running with degree of parallelism 64.

Questions: .1. why degree of parallelism is not 80 when no of logical processors is 80?

  1. Is my understanding correct that if there are 6 slow queries running over an hour all showing degree of parallelism 64 would be expected to slow as they might be hitting same threads and thus showing as cx packet waits. Hence I believe changing MAXDOP to say 16 or 8 by testing should give them their own threads to complete?

Thanks

asked Mar 19, 2019 at 17:57
4
  • 1
    Note that this is a scenario where you might want to turn off Hyperthreading to reduce the logical processors from 80 to 40. Or to set the CPU affinity to use 16 cores on each NUMA node. Commented Mar 20, 2019 at 0:27
  • @DavidBrowne-Microsoft: Thanks for your comment. But i did'nt understand why would one want to reduce the number of logical processors because additional 40 always sound good if we have these big select queries running on db 20 TB+ [querying partition]. Also setting CPU affinity will have what impact or assistance here. I am just trying to understand before going with any change Commented Mar 20, 2019 at 13:43
  • Hyperthreaded cores aren't real cores. It's a way to schedule two threads on a single core. So turning off hyperthreading has only a marginal impact on performance, one way or the other. But it would allow a single query to use all 40 of your cores, where today a single query can only use 32 cores. Commented Mar 20, 2019 at 15:11
  • @DavidBrowne-Microsoft: Thank you sir. Does that make any difference if that server has 4 numa nodes ? Commented Mar 20, 2019 at 18:07

1 Answer 1

7

The simple answer is that 64 is the DOP limit when zero is specified:

To enable the server to determine the maximum degree of parallelism, set this option to 0, the default value. Setting maximum degree of parallelism to 0 allows SQL Server to use all the available processors up to 64 processors.

A single query can use more than 64 cores if you set that specific number (i.e. not zero):

Set the value to a number from 1 to 32,767 to specify the maximum number of processor cores that can be used by a single query execution

See also SQL Server MAX DOP Beyond 64 – Is That Possible?

As for how SQL Server will allocate threads, this blog post is the closest I've seen to official documentation:

SQL Server Parallel Query Placement Decision Logic

answered Mar 19, 2019 at 20:23
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.