question

GPO avatar image
GPO asked

Changing maximum degrees of parallelism

If I want a particular query to run single threaded and subsequent queries to run with the server default, do I need to include the bottom line of SQL in the following code? SELECT b.blah FROM dbo.blah_blah b WHERE b.blah_size = 19 OPTION (MAXDOP 1) ; SELECT b.blah FROM dbo.blah_blah b WHERE b.blah_size = 19 OPTION (MAXDOP 0) ; Or will it revert back automagically as soon as the first query is finished?
parallelismmaxdopquery hintssingle-thread
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Grant Fritchey avatar image
Grant Fritchey answered
The hint only applies to the query that is running. It doesn't change anything for the rest of the server or any other queries, even in that batch. You don't need that second hint at all.
1 comment
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Awesome. Thanks Grant.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.