If a lot of rows or pages are locked, the SQL Server escalates to a table-level lock, to save resources. Each single lock takes approx. 100 bytes. So if you have many locks it takes a lot of resources to manage them. (There is a great blog about lock escalation, if you want some more info: https://blogs.msdn.com/b/sqlserverstorageengine/archive/2006/05/17/lock-escalation.aspx) Until SQL Server 2008, there was no way to change the lock escalation for a single table. You could deactivate the escalation for the server by using the Trace Flags:
But that was in most cases not a good choice and caused a lot of performance problems. In SQL-Server 2008 and above there is a new table option (ALTER-TABLE) that can be used to change the default Lock-Escalation. This helps you if you have a table where you want to disable the escalation or if the table is partitioned. On a partitioned table activating the AUTO Option can improve concurrency, by escalating the locks to the partition-level and not to the table-level. ALTER TABLE - table option: SET ( LOCK_ESCALATION = { AUTO | TABLE | DISABLE } )
This is a cool feature, that are many developers are not aware of. Thanks for Reading!
Ready to future-proof your SQL Server investment?