commands

^

Test-DbaMaxDop

Author Claudio Silva (@claudioessilva)
Availability Windows, Linux, macOS

 

Synopsis

Displays information relating to SQL Server Max Degree of Parallelism setting. Works on SQL Server 2005-2016.

Description

Inspired by Sakthivel Chidambaram's post about SQL Server MAXDOP Calculator (https://blogs.msdn.microsoft.com/sqlsakthi/p/maxdop-calculator/), this script displays a SQL Server's: max dop configured, and the calculated recommendation.

For SQL Server 2016 shows:

  • Instance max dop configured and the calculated recommendation
  • max dop configured per database (new feature)

More info: https://support.microsoft.com/en-us/kb/2806535 https://blogs.msdn.microsoft.com/sqlsakthi/2012/05/23/wow-we-have-maxdop-calculator-for-sql-server-it-makes-my-job-easier/

These are just general recommendations for SQL Server and are a good starting point for setting the "max degree of parallelism" option.

Syntax

Test-DbaMaxDop
    [-SqlInstance] <DbaInstanceParameter[]>
    [[-SqlCredential] <PSCredential>]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Test-DbaMaxDop -SqlInstance sql2008, sqlserver2012

Get Max DOP setting for servers sql2008 and sqlserver2012 and also the recommended one.

Example: 2
PS C:\> Test-DbaMaxDop -SqlInstance sql2014 | Select-Object *

Shows Max DOP setting for server sql2014 with the recommended value. Piping the output to Select-Object * will also show the 'NumaNodes' and 'NumberOfCores' of each instance

Example: 3
PS C:\> Test-DbaMaxDop -SqlInstance sqlserver2016 | Select-Object *

Get Max DOP setting for servers sql2016 with the recommended value. Piping the output to Select-Object * will also show the 'NumaNodes' and 'NumberOfCores' of each instance. Because it is an 2016
instance will be shown 'InstanceVersion', 'Database' and 'DatabaseMaxDop' columns.

Required Parameters

-SqlInstance

The target SQL Server instance or instances.

Alias
Required True
Pipeline true (ByValue)
Default Value

Optional Parameters

-SqlCredential

Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential). Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported. For MFA support, please use Connect-DbaInstance.

Alias
Required False
Pipeline false
Default Value
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message. This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting. Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

Alias
Required False
Pipeline false
Default Value False

 

Want to see the source code for this command? Check out Test-DbaMaxDop on GitHub.
Want to see the Bill Of Health for this command? Check out Test-DbaMaxDop.