SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


MAXDOP question


MAXDOP question

Author
Message
sunny.tjk
sunny.tjk
SSC-Addicted
SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)

Group: General Forum Members
Points: 497 Visits: 1344
The computer that i run queries on has 2 processors. Shouldn't query1 execute faster than query2 ? Surprisingly, both executed taking exact time. Also, on OLTP system, should MAXDOP be disabled or should I leave it as default setting?

Query1:
SELECT * FROM table
UNION
SELECT * FROM table1

Query2:
SELECT * FROM table
UNION
SELECT * FROM table1
OPTION (MAXDOP 1)

Query1 was using parallelism in the execution plan.
Jeff Moden
Jeff Moden
SSC Guru
SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)SSC Guru (88K reputation)

Group: General Forum Members
Points: 88382 Visits: 41128
sunny.tjk (9/13/2013)
The computer that i run queries on has 2 processors. Shouldn't query1 execute faster than query2 ? Surprisingly, both executed taking exact time. Also, on OLTP system, should MAXDOP be disabled or should I leave it as default setting?

Query1:
SELECT * FROM table
UNION
SELECT * FROM table1

Query2:
SELECT * FROM table
UNION
SELECT * FROM table1
OPTION (MAXDOP 1)

Query1 was using parallelism in the execution plan.


A part of your "problem" may be that you're returning the output to "The GREAT EQUALIZER"... the display. If you want to test such things, you'll need a large amount of data and some variables to dump each column into to take the display time out of the picture.

--Jeff Moden

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
If you think its expensive to hire a professional to do the job, wait until you hire an amateur. -- Red Adair

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
sunny.tjk
sunny.tjk
SSC-Addicted
SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)

Group: General Forum Members
Points: 497 Visits: 1344
Jeff Moden (9/13/2013)
sunny.tjk (9/13/2013)
The computer that i run queries on has 2 processors. Shouldn't query1 execute faster than query2 ? Surprisingly, both executed taking exact time. Also, on OLTP system, should MAXDOP be disabled or should I leave it as default setting?

Query1:
SELECT * FROM table
UNION
SELECT * FROM table1

Query2:
SELECT * FROM table
UNION
SELECT * FROM table1
OPTION (MAXDOP 1)

Query1 was using parallelism in the execution plan.


A part of your "problem" may be that you're returning the output to "The GREAT EQUALIZER"... the display. If you want to test such things, you'll need a large amount of data and some variables to dump each column into to take the display time out of the picture.



Jeff, table and table 1 have approx 600 thousand rows.
Grant Fritchey
Grant Fritchey
SSC-Forever
SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)

Group: General Forum Members
Points: 41105 Visits: 32666
I would not recommend disabling parallelism. It's a good thing. I would suggest that you bump up the default value for the cost threshold for parallelism. The default value of 5 is just too low. I'd suggest trying a number like 35 and then monitoring the system to see if you need to adjust from there. A good friend of mine who consults regularly says she starts at 50 and then does the same.

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
sunny.tjk
sunny.tjk
SSC-Addicted
SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)SSC-Addicted (497 reputation)

Group: General Forum Members
Points: 497 Visits: 1344
Grant Fritchey (9/14/2013)
I would not recommend disabling parallelism. It's a good thing. I would suggest that you bump up the default value for the cost threshold for parallelism. The default value of 5 is just too low. I'd suggest trying a number like 35 and then monitoring the system to see if you need to adjust from there. A good friend of mine who consults regularly says she starts at 50 and then does the same.


Grant, do i change the value of MAXDOP to the total number of physical CPUs?
Grant Fritchey
Grant Fritchey
SSC-Forever
SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)SSC-Forever (41K reputation)

Group: General Forum Members
Points: 41105 Visits: 32666
sunny.tjk (9/24/2013)
Grant Fritchey (9/14/2013)
I would not recommend disabling parallelism. It's a good thing. I would suggest that you bump up the default value for the cost threshold for parallelism. The default value of 5 is just too low. I'd suggest trying a number like 35 and then monitoring the system to see if you need to adjust from there. A good friend of mine who consults regularly says she starts at 50 and then does the same.


Grant, do i change the value of MAXDOP to the total number of physical CPUs?


There is no absolute rule for this. But if we're talking four or more processors, I'd start with one less than the number of processors. See how that affects behavior, monitor the system, the usual.

----------------------------------------------------
The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood...
Theodore Roosevelt

The Scary DBA
Author of: SQL Server Query Performance Tuning and SQL Server Execution Plans
Product Evangelist for Red Gate Software
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search