Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

lock problems on tempdb

Status
Not open for further replies.

PJSWEAT

Programmer
Feb 3, 2003
82
US

I have a programmer who has created a massive temporary table that inserts into another massive table with no commits (80 gigs). Currently, he has over 30,000 locks on tempdb, any idea what causes this or if it might be a problem with SQL SERVER and not the code?
 
Every time the server allocates an extent to a table it places a lock on it (e.g. while the insert is taking place) - this could be what you are seeing.

The creation of a temp table should be done outside a transaction as until it updates persistent data there is no need for a rollback. Do all te temp table processing first then create a transaction to update tables.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 

Makes sense, will the locks stay in place until the full update is complete? It's been running for several hours
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top