As we every one know we every application we are using run on top of an OS. Typically Windows operating system or may be Linux. SQL Server is running on top of Windows OS, now Linux as well. SQL Server has its own OS, which do the lot of tasks like , scheduling threads for CPU, memory managing, synchronizing, deadlocks detection, and many more.. Normally in our machine has multiple CPUs or logical processors which allows to do our tasks fast and parallelly.
We can check the number of CPUs our machine has in many ways.
1. Right-click task bar -> Task Manager -> Performance tab
2. We can write a SELECT query and retrieve the number of logical processors or cores belongs to our computer
SELECT cpu_count FROM sys.dm_os_sys_info; GO
Now lets see what is MAXDOP
MAXDOP or Maximum number of Degree Of Parallelism means we can allow or limit by set the value for MAXDOP as a query hint or else configure in sp_configure global configurations and execute the query parellely. Actually when we write a query as a query hint what it does, its override the value we have configured in sp_configure. The default configuration value is 0 (Which means unlimited)
In the below query maximum number of parallel threads which can be used limit to one.
SELECT * FROM dbo.FactFinance f INNER JOIN dbo.DimDate d ON f.DateKey = d.DateKey OPTION (MAXDOP 1); GO
Comments
Post a Comment