DAT315: Strategies to Get Maximum Concurrency for Your Workload

SQL Server:
SQL Server:
SQL Server:
SQL Server:
Tran2 (Select)
Tran1 (Update)
X-Lock
Row-1
S-Lock
Blocked
Statement-Level ‘Snapshot Isolation’
Writers do block writers
Transaction level ‘Snapshot Isolation’
Writers do block writers
Small lock granules, such as rows:
Maximize concurrency
Are expensive to maintain(require many lock manager calls).
Approx 100 byte overhead
Large granules, such as tables:
Expensive in terms of concurrency
Cheap to acquire (few lock manager calls)
Multi-granular lock protocols allow us to have it both ways
Decided at run-time using internal heuristic
Can be over-ridden using sp_indexoption or locking hint
Lock Escalation
Common locking modes
Mode
S
X
U
IS
IX
BU
SCH-S
SCH-M
Description
Share - used for reading
Exclusive - typically used for writing (insert, update, delete)
Update - used to evaluate prior to writing
Intent Share - share locking at finer level
Intent Exclusive - X locking at finer level
Bulk Update. Used in Bulk Load
Schema Share
Schema modify lock
10
T1: IX
HOBT
Page
Page
Row
T1: IX
Page
Row
T1: X
Row
T1: X
T1: X
T1: X
T1: X
T1: X
T1: X
T1: X
T1: X
Page Header
R1
R2
R3
www.microsoft.com/teched
www.microsoft.com/learning
http://microsoft.com/technet
http://microsoft.com/msdn
Sign up for Tech·Ed 2011 and save $500
starting June 8 – June 31st
http://northamerica.msteched.com/registration
You can also register at the
North America 2011 kiosk located at registration
Join us in Atlanta next year