Bobcares

Max Degree of Parallelism in SQL Server: Explained

by | Oct 20, 2022

Let us take a closer look at the role of max degree of parallelism in SQL server. We will go through the tool with the support of our MSSQL support services at Bobcares.

What is Max Degree of Parallelism in SQL Server?

max degree of parallelism in sql server

The setting MAXDOP in SQL Server controls the number of processors to use for executing the parallel plan. It can execute plans in parallel in SQL. It enables SQL Server to use the vast number of processors on current servers. MAXDOP, however, might set up wrong. The amount of parallelism on a server might be too much or too little.

What is the Effective Max Degree of Parallelism Setting?

We can enter a number between 0 and 32,767 for the Max Degree of Parallelism. The value guides SQL Server on how many processors to employ while executing a parallel plan.

When MAXDOP is 0, SQL Server has to utilize every processor (up to a max of 64). However, just because a computer includes a CPU doesn’t mean that processor is actually usable.

Whether SQL Server views a processor as available might depend on licensing and other variables. Therefore, when MAXDOP is 0, the script turns to the sys.dm os schedulers system view to determine the online schedulers. This guarantees the effective usage of the MAXDOP.

SELECT
@EffectiveMaxDop = CAST(value_in_use AS INT)
FROM
sys.configurations
WHERE
[name] = N'max degree of parallelism';
IF @EffectiveMaxDop = 0
BEGIN
SELECT
@EffectiveMaxDop = COUNT(*)
FROM
sys.dm_os_schedulers
WHERE
scheduler_id <= 1048575
AND is_online = 1;
END

Use SQL Server Management Studio or Azure Data Studio

In Azure Data Studio, install the Database Admin Tool Extensions for Windows extension, or use the below T-SQL method.

To set up the Max degree of Parallelism option

These options change the MAXDOP for the instance.

  1. Firstly, right click the appropriate instance in Object Explorer and choose Properties.
  2. After that, select the Advanced node after that.
  3. Finally, choose the most processors to employ for carrying out the parallel plan in the Max Degree of Parallelism box.

Use Transact-SQL

To set up the max degree of parallelism option with T-SQL

  1. Firstly, use SQL Server Management Studio or Azure Data Studio to set up a connection to the database engine.
  2. After that, choose New Query from the Standard bar.
  3. Copy and paste the following sample into the query field before Executing. This example will show us how to set the max degree of parallelism parameter to 16 using the sp setup.

SQL

USE AdventureWorks2012 ;
GO
EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE WITH OVERRIDE;
GO
EXEC sp_configure 'max degree of parallelism', 16;
GO RECONFIGURE WITH OVERRIDE;
GO

[Need assistance with similar queries? We are here to help]

Conclusion

To conclude we have gone through the usage of the max degree of parallelism in SQL server. We have also learned how it can be a handy tool for us to use. With the support of our MSSQL support services, we have gone through all of the necessary settings.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.