Partilhar via


max degree of parallelism Option

When SQL Server 2005 runs on a computer with more than one microprocessor or CPU, it detects the best degree of parallelism, that is, the number of processors employed to run a single statement, for each parallel plan execution. You can use the max degree of parallelism option to limit the number of processors to use in parallel plan execution. The default value of 0 uses all available processors. Set max degree of parallelism to 1 to suppress parallel plan generation. Set the value to a number greater than 1 (up to a maximum of 64) to restrict the maximum number of processors used by a single query execution. If a value greater than the number of available processors is specified, the actual number of available processors is used. If the computer has only one processor, the max degree of parallelism value is ignored.

Overriding max degree of parallelism

SQL Server will consider parallel execution plans for queries, index data definition language (DDL) operations, and static and keyset-driven cursor population. For more information about parallel execution, see Degree of Parallelism.

You can override the max degree of parallelism value in queries by specifying the MAXDOP query hint in the query statement. For more information, see Query Hint (Transact-SQL).

Index operations that create or rebuild an index, or that drop a clustered index, can be resource intensive. You can override the max degree of parallelism value for index operations by specifying the MAXDOP index option in the index statement. The MAXDOP value is applied to the statement at execution time and is not stored in the index metadata. For more information, see Configuring Parallel Index Operations.

In addition to queries and index operations, this option also controls the parallelism of DBCC CHECKTABLE, DBCC CHECKDB, and DBCC CHECKFILEGROUP. You can disable parallel execution plans for these statements by using trace flag 2528. For more information, see Trace Flags (Transact-SQL).

Note

If the affinity mask option is not set to the default, it may restrict the number of processors available to SQL Server on symmetric multiprocessing (SMP) systems.

Setting the max degree of parallelism Option

The max degree of parallelism option is an advanced option. If you are using the sp_configure system stored procedure to change the setting, you can change max degree of parallelism only when show advanced options is set to 1. The setting takes effect immediately (without restarting the MSSQLSERVER service).

The following example sets the max degree of parallelism option to 8.

sp_configure 'show advanced options', 1;
GO
RECONFIGURE WITH OVERRIDE;
GO
sp_configure 'max degree of parallelism', 8;
GO
RECONFIGURE WITH OVERRIDE;
GO

For more information about setting the max degree of parallelism value in SQL Server Management Studio, see How to: Configure the Number of Processors Available for Parallel Queries (SQL Server Management Studio).

See Also

Concepts

affinity mask Option
cost threshold for parallelism Option
Setting Server Configuration Options
Parallel Query Processing
Configuring Parallel Index Operations
Setting Index Options
max worker threads Option

Other Resources

RECONFIGURE (Transact-SQL)
sp_configure (Transact-SQL)
CREATE INDEX (Transact-SQL)
ALTER INDEX (Transact-SQL)
ALTER TABLE (Transact-SQL)
DBCC CHECKTABLE (Transact-SQL)
DBCC CHECKDB (Transact-SQL)
DBCC CHECKFILEGROUP (Transact-SQL)
Query Hint (Transact-SQL)

Help and Information

Getting SQL Server 2005 Assistance