Let\u2019s say you\u2019ve \u201cdisabled\u201d parallelism on your SQL Server instance via the \u2018max degree of parallelism\u2019 setting as follows:<\/span><\/span><\/p>\n EXEC<\/span><\/span><\/span> sp_configure<\/span><\/span>‘max degree of parallelism’<\/span><\/span>,<\/span><\/span> 1<\/span><\/span><\/span><\/p>\n RECONFIGURE<\/span><\/span><\/span><\/p>\n \n \n Now most folks know (or are finding out) that this doesn\u2019t really<\/em> prevent parallel plans if you throw in a MAXDOP hint.\u00a0 <\/span>For example, let\u2019s take the following query:<\/span><\/span><\/p>\n \n EXEC<\/span><\/span><\/span> sp_executesql<\/span><\/span><\/span><\/span><\/span><\/p>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><\/span><\/span>N’SELECT charge_no FROM dbo.charge<\/span><\/span><\/span><\/p>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span>WHERE charge_dt = @charge_dt OPTION (MAXDOP 4)’<\/span><\/span><\/span>,<\/span><\/span><\/span><\/p>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span>N’@charge_dt datetime’<\/span><\/span>,<\/span><\/span><\/span>\u00a0 <\/span><\/span><\/span><\/span><\/p>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span>@charge_dt<\/span><\/span> =<\/span><\/span> ‘1999-07-20 10:49:11.833’<\/span><\/span><\/span>;<\/span><\/span><\/span><\/span><\/p>\n \n If we look at the actual plan and properties, even though I\u2019ve capped the instance level max degree of parallelism, I get a parallel plan (using <\/span><\/span>SQL Sentry Plan Explorer<\/span><\/a><\/span>):<\/span><\/span><\/p>\n \n \n Now let\u2019s say I want to out-smart anyone capping the MAXDOP by using Resource Governor and the MAX_DOP workload group setting:<\/span><\/span><\/p>\n \n CREATE<\/span><\/span><\/span> WORKLOAD<\/span><\/span> GROUP<\/span><\/span> <\/span>wgReportUsers<\/span><\/span><\/span><\/span><\/p>\n WITH<\/span><\/span><\/span><\/p>\n (<\/span><\/span><\/span><\/p>\n \u00a0\u00a0\u00a0\u00a0 <\/span><\/span>MAX_DOP<\/span><\/span> =<\/span><\/span> 1<\/span><\/span><\/span><\/p>\n )<\/span><\/span><\/span> USING<\/span><\/span> <\/span>[rpReportUsers]<\/span><\/span><\/span><\/span><\/p>\n GO<\/span><\/span><\/span><\/p>\n \n \n I also created a classifier function and a resource pool (assuming I want to restrict anything else).\u00a0 <\/span>I won\u2019t add that setup code here since it\u2019s just the standard RG configuration process.\u00a0 <\/span>For this example I\u2019ve configured nothing unusual with the exception of setting MAX_DOP = 1 and making sure my reporting user gets classified to the constrained workload group.<\/span><\/span><\/p>\n \n Now let\u2019s say the user connects in after RG is configured.\u00a0 <\/span>I am able to confirm this via Profiler through the PreConnect:Completed event class:<\/span><\/span><\/p>\n \n \n In this example, GroupId 257 maps to my workload group.<\/span><\/span><\/p>\n So I\u2019m logged in as the report user, and I\u2019ve given that user the appropriate read-permissions and also SHOWPLAN so we can see that serial plan we\u2019re expecting.\u00a0 <\/span>I also cleared the cache so that the new execution would be a new compilation.<\/span><\/span><\/p>\n But what do we see when the user tries to override the MAXDOP?<\/span><\/span><\/p>\n \n EXEC<\/span><\/span><\/span> sp_executesql<\/span><\/span><\/span><\/span><\/span><\/p>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span><\/span><\/span>N’SELECT charge_no FROM dbo.charge<\/span><\/span><\/span><\/p>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span>WHERE charge_dt = @charge_dt OPTION (MAXDOP 4)’<\/span><\/span><\/span>,<\/span><\/span><\/span><\/p>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span>N’@charge_dt datetime’<\/span><\/span>,<\/span><\/span><\/span>\u00a0 <\/span><\/span><\/span><\/span><\/p>\n \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <\/span><\/span>@charge_dt<\/span><\/span> =<\/span><\/span> ‘1999-07-20 10:49:11.833’<\/span><\/span><\/span>;<\/span><\/span><\/span><\/span><\/p>\n \n \n And you\u2019ll see the same in SQL Server Management Studio (in case you were wondering):<\/span><\/span><\/p>\n \n So what about the rows per thread that I showed you earlier?\u00a0 <\/span>How does it look now?\u00a0 <\/span>This time, there are no separate columns by thread:<\/span><\/span><\/p>\n \n
<\/a><\/span><\/p>\n
<\/a><\/span><\/p>\n
<\/a><\/span><\/p>\n
<\/a><\/span><\/p>\n
<\/a><\/span><\/p>\n