The query below will only use up to 2 processors for parallel operation regardless of the number of processors available.
USE AdventureWorks
GO
SELECT ProductID, OrderQty, SUM(LineTotal) As Total
FROM Sales.SalesOrderDetail
WHERE UnitPrice < $10.00
GROUP BY ProductID, OrderQty
ORDER BY ProductID, OrderQty
OPTION (MAXDOP 2)
GO
To set the option for SQL Server to always use up to X number of processors, you can use SP_Configure.
For example, the following query forces SQL engine to only use 4 processors.
USE Master
GO
SP_Configure 'Show Advanced Options', 1
GO
RECONFIGURE
GO
SP_Configure 'Max Degree of Parallelism', 4
GO
RECONFIGURE
GO
Default "Max Degree of Parallelism" option is 0, which means use all available processors up to 64.
Thank you.
No comments:
Post a Comment
As always, your comments are welcome and appreciated!