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


Tempdb issue


Tempdb issue

Author
Message
Grant Fritchey
Grant Fritchey
SSC Guru
SSC Guru (99K reputation)SSC Guru (99K reputation)SSC Guru (99K reputation)SSC Guru (99K reputation)SSC Guru (99K reputation)SSC Guru (99K reputation)SSC Guru (99K reputation)SSC Guru (99K reputation)

Group: General Forum Members
Points: 99495 Visits: 33014
samsql (5/20/2010)
yes saby i m gettin blocking in the tempdb.

Grant there are procedure with begin and tran
E.g
proc ssa
(
Begin tran
exec procedure1
-----create some temp table and do some updation,insertion etc on temp table and physical table as there are more than 5 tables in each proc ...

exec procedure2 -----create some temp table and do some updation,insertion etc on temp table and physical table as there are more than 5 tables in each proc ...

exec procedure3-----create some temp table and do some updation,insertion etc on temp table and physical table as there are more than 5 tables in each proc ...

commit

run with diffrent sessions got the blocking while creating a temp table
and one more thing is that the table creation takes 2 secs to create which is really more time.

it destroy the table after the 1 procedure get fully exec till commit.


Yes, that procedure that is calling all the other procedures will hold those temp tables in place until it completes. It doesn't matter that those procedures have transactions of their own, the wrapper proc acts as the main transaction and the temp tables will be held until it commits or rolls back.

----------------------------------------------------
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
Robert Davis
Robert Davis
SSCertifiable
SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)SSCertifiable (6.7K reputation)

Group: General Forum Members
Points: 6744 Visits: 1632
in SQL Server 2005+, they no longer drop all temp tables from the tempDB. A small cache of 16 temp tables are saved in a special area of cache. This was done to prevent the overhead of constantly allocating new tables for systems that create a lot of temp tables. If an unused table exists in cache, it will use one of them, if not, it creates a new one.

This is why you will see temp tables hang around. You can read more about that on Paul Randal's blog: Misconceptions around TF-1118

If you are experiencing tempDB contention, then you likely do not have your tempDB configured per best practices. Your data files should all be the same size, and you should have multiple data file, somewhere from 1/4 to 1 data file per logical processor. I would suggest starting with 1/4 to 1/2 data file per CPU and increase it if contention persists. You should also separate your tempDB files to a dedicated drive separate from the other databases' files.

When you are experiencing heavy blocking in the tempDB, you can use the script on my blog for determining if the contention is on allocation pages (GAM, SGAM, PFS) or data pages: Breaking Down TempDB Contention



My blog: SQL Soldier
Twitter: @SQLSoldier
My book: Pro SQL Server 2008 Mirroring
Microsoft Certified Master, SQL Server MVP
Database Engineer at BlueMountain Capital Management
saby
saby
SSC-Addicted
SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)

Group: General Forum Members
Points: 491 Visits: 277
Samsql,Grant i had a discussion with MS Team this is fixed in SQL 11 version but not sure about 2008 R2..
They are making an hotfix for it for sqlserver 2005.will let u know once it is launches.
saby
saby
SSC-Addicted
SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)SSC-Addicted (491 reputation)

Group: General Forum Members
Points: 491 Visits: 277
Hi sam below is the KB for ur issue
KB Article Number(s): 2133566
curious_sqldba
curious_sqldba
SSCertifiable
SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)SSCertifiable (7.6K reputation)

Group: General Forum Members
Points: 7566 Visits: 3696
saby (6/8/2010)
Hi sam below is the KB for ur issue
KB Article Number(s): 2133566
'

Hey , can you please post the actual link for the hotfix?
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