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


SQL 2008 R2 tempdb growth/MAXDOP


SQL 2008 R2 tempdb growth/MAXDOP

Author
Message
sqlGDBA
sqlGDBA
Mr or Mrs. 500
Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)

Group: General Forum Members
Points: 519 Visits: 315
We have a certain query that now seems to result in tempdb growing until the disk runs out of space. This has started happening recently, and seems to be very similar to an issue we had about a year ago. The problem is alleviated if you supply a MAXDOP hint with the query and ask the engine to use MAXDOP 1. It looks like there may be a bug whereby the optimizer uses a different DOP and keeps trying to allocate more and more space for a worktable in tempdb until it runs out of space.

I had opened a case with Microsoft at the time, and they had acknowledged that it was a bug. Anyone know if this has been fixed yet ? I cannot find any references to this bug or its listing as a bug or a resolution. I tried to email the MS case workers on the previous threads when I had opened the case, and the emails bounced back with "access denied" errors. I guess they dont encourage people contacting them after the case is closed.
sqlGDBA
sqlGDBA
Mr or Mrs. 500
Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)

Group: General Forum Members
Points: 519 Visits: 315
No thoughts ? Anyone ?Whistling
anthony.green
anthony.green
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24708 Visits: 6519
Can you post the query?



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
When a question, really isn't a question - Jeff Smith
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger


patrickmcginnis59
patrickmcginnis59
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1557 Visits: 2333
I have a thought. The thought is that I hope I don't write a query that blows up tempdb like that in production(not trying to imply that you did)! Whats the actual mechanics of the query that baloons up the tempdb? Is it some sort of concurrent subquery thing or something? I'm always on the lookout for surprises like this, having just recently learned that Microsoft still cannot fundamentally manage storage (http://support.microsoft.com/kb/307487 "can't resize tempdb while in use" also known as failing comp sci 101), I'm sort of trying to collect info traps like this and that.
sqlGDBA
sqlGDBA
Mr or Mrs. 500
Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)

Group: General Forum Members
Points: 519 Visits: 315
:-) Thank you for the replies. The code unfortunately, is confidential. However, it would still be too complex even if I could post it. This is part of the code base for a product and heence so. The query is against a view, which is based on joins two other views(aliased twice each, I think) and a table. The views at this level are also based on one other view and a few tables, with a UNION ALL of 3 queries(Yes I know !! :w00tSmile. Some of those views also used derived tables in the join etc.

Its a long story(too long to go into it here) as to why these queries need to be so incredibly complex. However, the bottomline is this: The tables this query goes after may total about 5 GB in data in a database thats about 10 - 12 GB in size, and tempdb bloats up to 70 GB (!!!) if the MAXDOP hint is not supplied. As I mentioned earlier, I had opened a case with MS in July 2011 where they had agreeed that it was a bug. I tested again with SP2, and its only marginally better. On different hardware, on SP2, the query used about 25 GB of tempdb space without the MAXDOP hint. Using MAXDOP 1 reduces tempdb usage to about 4 / 5 GB. Go figure !!
sqlGDBA
sqlGDBA
Mr or Mrs. 500
Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)

Group: General Forum Members
Points: 519 Visits: 315
patrickmcginnis59 (12/12/2012)
I'm always on the lookout for surprises like this, having just recently learned that Microsoft still cannot fundamentally manage storage (http://support.microsoft.com/kb/307487 "can't resize tempdb while in use" also known as failing comp sci 101), I'm sort of trying to collect info traps like this and that.


The surprise(or should it be ??) is that it is a bug, as acknowledged by them more than a year ago. I dont see this as being completely addressed with SP2, and was curious to see if anyone else had run into something like this. We have virtualized all the environments that I had benchmarked this on since this occurred last, and I am not about to go change our production environment to test this out. When the proverbial s**t hit the fan last year, the workaround was to limit the DOP on all queries (by setting MAXDOP in sp_configure) and take it out of the optimizer's hands so we dont run into this again. Who knows how much overhead we are now incurring because it would actually be optimal to parallelize a query !! I would not like to second guess the optimizer if given a choice, but in this instance, we didn't have a choice. I've posted this on MSDN forums too with the case number, and MS techs generally patrol those forums, so I am hoping for something concrete from them.
patrickmcginnis59
patrickmcginnis59
SSCommitted
SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)SSCommitted (1.6K reputation)

Group: General Forum Members
Points: 1557 Visits: 2333
sqlGDBA (12/12/2012)
patrickmcginnis59 (12/12/2012)
I'm always on the lookout for surprises like this, having just recently learned that Microsoft still cannot fundamentally manage storage (http://support.microsoft.com/kb/307487 "can't resize tempdb while in use" also known as failing comp sci 101), I'm sort of trying to collect info traps like this and that.


The surprise(or should it be ??) is that it is a bug, as acknowledged by them more than a year ago. I dont see this as being completely addressed with SP2, and was curious to see if anyone else had run into something like this. We have virtualized all the environments that I had benchmarked this on since this occurred last, and I am not about to go change our production environment to test this out. When the proverbial s**t hit the fan last year, the workaround was to limit the DOP on all queries (by setting MAXDOP in sp_configure) and take it out of the optimizer's hands so we dont run into this again. Who knows how much overhead we are now incurring because it would actually be optimal to parallelize a query !! I would not like to second guess the optimizer if given a choice, but in this instance, we didn't have a choice. I've posted this on MSDN forums too with the case number, and MS techs generally patrol those forums, so I am hoping for something concrete from them.


So are you saying that the MAXDOP hint to individual queries are ignored, or just that you'd rather not supply the MAXDOP at all? Can you modify problematic queries or do they have to run as is?

http://www.sqlservercentral.com/Forums/Topic1067746-391-1.aspx <--- interesting thread regarding MAXDOP.
sqlGDBA
sqlGDBA
Mr or Mrs. 500
Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)Mr or Mrs. 500 (519 reputation)

Group: General Forum Members
Points: 519 Visits: 315
No - we would not want to supply individual query hints. I would shy away from second guessing the optimizer with any sort of query hint - Index / join / MAXDOP, you name it. Although God knows I have seen enough instances of each one of those where the optimizer didnt pick the right one.

We ended up setting the server default to a low number so that the optimizer would see that and not use, say a DOP of 8 to resolve a query and go crazy with tempdb. With a lower setting of MAXDOP at the server level, the optimizer is constrained to only spawn so many threads to resolve any query, and from our observations, also uses a proportionally smaller amount of space in tempdb.

Very interesting thread indeed - thanks for that;-). Need to digest all the SQLKiwi says there.
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