HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Default SQL Server 2008 locking behaviour

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
2008sqldefaultlockingbehaviourserver

Problem

I am using SQL Server 2008.

-
What is the default lock behaviour with UPDATE?

  • NOLOCK?



  • ROWLOCK?



  • PAGLOCK?



-
How can I tell what the current level of lock is for a table?

Thanks,
Bruce

Solution

It really depends on how much you're updating. Locks will escalate as the size of the query increases. If many rows within the same page will be modified, SQL Server will escalate to a PAGLOCK. If many pages will be modified, it will escalate to a TABLOCK.

Context

StackExchange Database Administrators Q#9177, answer score: 3

Revisions (0)

No revisions yet.