Whenever I work with SQL Server, I’m amazed at how many ways there are to influence its behavior. For example, take the maximum degree of parallelism for a query. Just offhand, I thought of ten different ways you can tweak it:
1. At the server level with SSMS. In SSMS, right-click on the server, click Properties, Advanced, scroll down into the Parallelism section, and set MAXDOP to 1. Click OK. (Be aware that this blows your plan cache instantly.)
2. At the server level with sp_configure. Just the command level version of the above, with the same side effect:
1 2 3 4 |
EXEC sys.sp_configure N'max degree of parallelism', N'1' GO RECONFIGURE GO |
3. At the query level with hints. Use OPTION (MAXDOP 1) at the end of your query to tie its hands behind its back. Interestingly, when you view the execution plan, the SELECT operator’s NonParallelPlanReason says “MaxDOPSetToOne” – which it is, but just at the query level, not what you might have expected. Even less expected: your hint can go HIGHER (not just lower) than the server-level setting.

4. By setting Cost Threshold for Parallelism really high. If you play around with this lesser-known parallelism setting and raise it up in the thousands (or millions or whatever), you can effectively set MAXDOP to 1. This comes in handy when some jerk puts a high MAXDOP hint in their query: they’re only picking the max degree of parallelism IF the query goes parallel. By setting CTfP high, you’re making sure it won’t go parallel. Insert diabolical laugh here.
5. By configuring Resource Governor. This Enterprise Edition feature lets you create a workload group with a MAX_DOP hint. (Yes, it has an underscore between MAX and DOP. No, I don’t know why. Yes, this can also override the server-level setting upwards.)
6. By using parallelism-inhibiting T-SQL. Paul White has an excellent rundown of things that will effectively set your entire query (or zones of the plan) to be MAXDOP 1.
7. By using query-level trace flag 8649. In that same post, Paul shows how OPTION (QUERYTRACEON 8649) can force your query to go parallel. Look, I didn’t title this blog post “Great Ideas in Query Tuning.”
8. By using Adam Machanic’s make_parallel() function. Add this adorable little function to your queries, and SQL Server thinks it’s going to be dealing with 1,099,511,627,776 rows – when there’s really only one. Hee hee!
9. By putting scalar functions in computed columns. Erik discovered that just by having these nasty little devils in your database, you’re not just causing user queries to go single-threaded, but even index maintenance and CHECKDB operations miss out on the joy of parallelism.

10. By setting it at the database level in SQL Server 2016. Right-click on your database and click Properties, and in the Options pane, there’s a handful of nifty new options including Max DOP and Max DOP For Secondary.
10a. By creating a different database just for parallelism. If you fully-qualify your database objects in queries like this:
1 |
SELECT * FROM StackOverflow.dbo.Users; |
Then you can get different MAXDOP settings simply by running your query in different databases – depending on their database-level parallelism settings. Here’s a screenshot of my database list that may help explain where I’m going with this:

That’s right – depending on where I run that query, it’ll get different parallelism options.
14 Comments. Leave new
Since we aren’t necessarily talking about good options, how about using DBCC OPTIMIZER_WHATIF(CPUs, 1)?
Dan – HAHAHA, I love it! That’s absolutely true.
Nice write-up Brent! There’s a list of non-parallel plan reasons that may also force a MAXDOP=1 situation:
http://www.sqlskills.com/blogs/joe/sql-server-2012-execution-plans-nonparallelplanreason/
Near the bottom of the comments. It’s a little out-of-date, I know the Hekaton one changed names, and may not apply to SQL 2016.
So what is the scope of these different options? If I change it at the server level, does that trickle down to the databases level?
David – that’s beyond the scope of the post, but it’s a great question! If you’ve got the time to run experiments to document it thoroughly, that’d be a great start for a blog post of your own. (This stuff is hard work, heh.)
I’ll see what I can find out!
You have some great stuff here.
Thanks!
Thanks!
it’s 3 years later but does it trickle down? I assumed it would, server wide would be server wide?
No.
Ugh, Bret! I’m facing a parallelism issue and I’m actually subscribed to your DBA training, what module should I run though so I understand whats going on here and how to set it. Microsoft engineer has us changing mdop to 8 at the server level, do we need to also set at the database level?
The parallelism module in Mastering Server Tuning.
Be aware of the changes changing the MAXDOP at the server level incurs. The plan cache instances get flushed.
An impressive tour de force !
I found that Paul White’s article has moved to:
https://www.sql.kiwi/2011/12/forcing-a-parallel-query-execution-plan.html
Best regards!