13. Understanding the Locking System : Lock Modes
 
Share this page                  
Lock Modes
A lock has a mode that determines its power--whether it prevents other users from reading or changing the locked resource.
There are six lock modes:
X
Exclusive locks can be read or write.
Only one transaction can hold an exclusive lock on a resource at a given time. A user of this lock is called a writer.
U
Update locks.
Only one transaction can hold an update lock on a resource at any given time. Update lock protocols are used to increase concurrency and reduce the risk of deadlocks
For rows and pages that have not been updated within the transaction, update locks can be converted to shared locks.
S
Shared locks or read locks.
Multiple transactions can hold shared locks on the same resource at the same time. No transaction can update a resource with a shared lock. A user of this lock is called a reader.
IX, IS
Intent exclusive and intent shared locks.
The locking system grants an intent exclusive (IX) or intent shared (IS) lock at the table level before it grants an exclusive (X) or shared (S) lock on a page in a table. An intent lock on a table indicates a finer level of lock granularity (that pages in the table are being accessed). An IX lock at table level indicates that pages have been updated, a IS lock at table level indicates that pages have been read.
SIX
Shared intent exclusive locks.
SIX ("shared with intent to update") locks can be considered as combination of S (shared) locks and IX (intent exclusive) locks. SIX locks are used in table locking strategies to minimize the extent of exclusive locking requirements.
N
Null locks.
Null locks do not block any other lock, but preserve the contents of the lock value block or preserve the locking structures for further use.