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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using table locks

Status
Not open for further replies.

thegeezza

Technical User
Jan 24, 2004
27
0
0
GB
Morning,

If you have a query that you know update every row in a table, is there a significant performance benifit in aquireing an exclusive table lock within the query (as opposed to SQL Server escalating various lower level locks)?

Hope this makes sense.

Cheers,
TheGeezza
 
Significant - it depends on query itself. If there are some cursors in action then answer is very probably "yes". If query is atomic by nature (e.g. single mass UPDATE) then optimizer might know what should be locked in advance and immediately attempt table lock (= no performance benefits).

------
"There's a man... He's bald and wears a short-sleeved shirt, and somehow he's very important to me. I think his name is Homer."
(Jack O'Neill, Stargate)
[banghead]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top