max degree of parallelism

  • Hi,

    I would like to know how to get max degree of parallelism via SQL statement?

  • SELECT ProductID, OrderQty, SUM(LineTotal) AS Total

    FROM Sales.SalesOrderDetail

    WHERE UnitPrice < 4

    GROUP BY ProductID, OrderQty

    ORDER BY ProductID, OrderQty

    OPTION (MAXDOP 2);

  • I mean how I can query the SQL Server settings via SQL statement, e.g. maximum degree of parallelism?

  • Use sp_configure. I think there's also a catalog view, called something like sys.configurations, that you can query directly.

    John

  • My question is why? What are you looking for with maxdop?

    In addition to looking at max degree of parallelism, you should also look at "cost threshold for parallelism".

    Far too often, the maxdop is changed to correct a perceived problem, when it's actually the cost threshold that needs to be changed.

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

  • You can also look at the query plan and see how many threads are running from the outputs of parallel operations.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • To get the current max degree of parallelism for a specific instance of SQL Server:

    SELECT value_in_use

    FROM sys.configurations

    WHERE name = 'max degree of parallelism'

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply