Skip to content

Instantly share code, notes, and snippets.

@Otterpohl
Created May 13, 2022 16:23
Show Gist options
  • Select an option

  • Save Otterpohl/527d8037cacd2d9cc25a9a1d583cc8ed to your computer and use it in GitHub Desktop.

Select an option

Save Otterpohl/527d8037cacd2d9cc25a9a1d583cc8ed to your computer and use it in GitHub Desktop.

Revisions

  1. Otterpohl created this gist May 13, 2022.
    21 changes: 21 additions & 0 deletions Set-MaxDOP
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    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