Created
May 13, 2022 16:23
-
-
Save Otterpohl/527d8037cacd2d9cc25a9a1d583cc8ed to your computer and use it in GitHub Desktop.
Set MaxDOP to match number of cores
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EXEC sys.sp_configure N'show advanced options', 1 | |
GO | |
RECONFIGURE WITH OVERRIDE | |
GO | |
DECLARE @DOP INT | |
SELECT @DOP = CASE | |
WHEN cpu_count > 16 THEN 8 | |
else cpu_count / 2 | |
END | |
FROM sys.dm_os_sys_info | |
EXEC sys.sp_configure N'max degree of parallelism', @DOP | |
GO | |
RECONFIGURE WITH OVERRIDE | |
GO | |
EXEC sys.sp_configure N'show advanced options', 0 | |
GO | |
RECONFIGURE WITH OVERRIDE | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment