How to efficiently use LOCK_ESCALATION mssql 2008
Posted
by
Avias
on Stack Overflow
See other posts from Stack Overflow
or by Avias
Published on 2012-12-19T05:01:41Z
Indexed on
2012/12/19
5:03 UTC
Read the original article
Hit count: 158
I'm currently having troubles with frequent deadlocks with a specific user table in MS SQL 2008. Here are some facts about this particular table:
- Has a large amount of rows (1 to 2 million)
- All the indexes used on this table only has "use row lock" ticked on its option
rows are frequently updated by multiple transactions but are unique (e.g. probably a thousand or more update statements are executed to different unique rows every hour)
the table does not use partitions.
Upon checking the table on sys.tables, I found that the lock_escalation is set to TABLE
I'm very tempted to turn the lock_escalation for this table to DISABLE but I'm not really sure what side effect this would incur. From What I understand, using DISABLE will minimize escalating locks to TABLE level which if combined with the row lock settings of the indexes should theoretically minimize the deadlocks I am encountering..
From what I have read in Determining threshold for lock escalation it seems that locking automatically escalates when a single transaction fetches 5000 rows..
What does a single transaction mean in this sense? A single session/connection getting 5000 rows thru individual update/select statements?
Or is it a single sql update/select statement that fetches 5000 or more rows?
Any insight is appreciated, btw, n00b DBA here
Thanks
© Stack Overflow or respective owner