What Lock Escalation Is and How to Stop It

A large change can trigger lock escalation and affect sessions that touch different rows in the same table. Confirm that escalation actually occurred before treating every blocking problem as the same issue.

Several small plain brass locks beside one larger plain lock on a warm wooden tabletop.

Understand the Change in Lock Granularity

SQL Server can replace many fine-grained locks with a coarser lock to reduce lock-management overhead. Traditional escalation commonly moves row or page locks to a table lock. Supported partitioned-table configurations can use partition-level escalation.

The familiar 5,000 figure is a clue, not a promise that the 5,000th changed row triggers escalation. Locks and rows are different counts. Memory pressure and the statement's locking behavior also matter.

An attempted escalation can fail when an incompatible lock prevents it. SQL Server can continue using finer locks and retry later. Do not infer the complete sequence from the final number of rows affected.

Confirm the Event and the Blocking

Use an Extended Events session with the lock_escalation event to capture evidence during the relevant workload. Filter and retain the session appropriately for the investigation. A table lock alone does not prove that escalation created it.

SELECT name, description
FROM sys.dm_xe_objects
WHERE object_type = 'event'
  AND name = N'lock_escalation';
SELECT session_id, blocking_session_id, wait_type, wait_time
FROM sys.dm_exec_requests
WHERE blocking_session_id > 0;

The first query discovers the event; it does not capture occurrences. The second shows current blocked requests. Correlate an actual captured escalation with the affected object, session, and time window.

SELECT request_session_id, resource_type,
       request_mode, request_status,
       resource_associated_entity_id
FROM sys.dm_tran_locks
WHERE resource_database_id = DB_ID()
ORDER BY request_session_id, resource_type;

Monitoring other sessions requires suitable permissions. This snapshot can be large on a busy database, so narrow it to known sessions when possible. Interpret intent locks separately from shared or exclusive object locks.

Reduce the Work Inside Each Transaction

When the business operation allows partial progress, commit bounded batches instead of one enormous change. The commit boundary matters more than placing TOP inside one outer transaction. A long outer transaction can retain the problem across all batches.

CREATE TABLE #EscalationBatchDemo
(
    RowId int PRIMARY KEY,
    Processed bit NOT NULL
);
INSERT #EscalationBatchDemo VALUES
(1,0),(2,0),(3,0),(4,0),(5,0);
-- Run with no surrounding transaction and implicit transactions OFF.
WHILE 1 = 1
BEGIN
    UPDATE TOP (2) #EscalationBatchDemo
    SET Processed = 1
    WHERE Processed = 0;
    IF @@ROWCOUNT = 0 BREAK;
END;
SELECT * FROM #EscalationBatchDemo ORDER BY RowId;

This tiny example demonstrates independently committed batch structure, not an escalation reproduction. A production process also needs a suitable key, efficient predicate, and restart behavior. Choose a batch size from measurement rather than copying the example's value.

Batching changes atomicity when it replaces one transaction with several. Confirm that the business accepts intermediate states. Some operations must remain atomic and need a different solution.

Improve the Access Path

A statement may examine or lock far more rows than it ultimately changes. Review the actual plan, predicates, and indexes before altering locking settings. Better access paths can reduce both elapsed time and the lock footprint.

Make predicates searchable and keep statistics appropriate for the workload. Consider lookup-heavy plans and unnecessary scans during the investigation. An index is justified by the complete workload, including its write and storage costs.

SELECT SCHEMA_NAME(schema_id) AS schema_name,
       name, lock_escalation_desc
FROM sys.tables
WHERE is_ms_shipped = 0
ORDER BY schema_name, name;

This reads each table's escalation setting. It does not show whether escalation occurred or whether changing the setting would help. Keep configuration evidence separate from event evidence.

Check Modern Locking Behavior

SQL Server 2025 offers optimized locking, which reduces lock memory and escalation pressure for supported workloads. It requires accelerated database recovery and is disabled by default on SQL Server. Review its prerequisites and behavior before testing adoption.

Database settings and isolation choices therefore matter when comparing two servers. A traditional locking demonstration may not describe a database using optimized locking. Record the actual configuration with the evidence.

Do not assume ROWLOCK prevents escalation or NOLOCK solves write contention. Broadly disabling escalation can increase lock-memory pressure. Use targeted diagnosis instead of replacing one resource problem with another.

Verify the Fix Under Concurrency

Repeat the representative workload with concurrent readers and writers after the proposed change. Compare escalation events, blocking duration, throughput, and correctness. A faster isolated update does not prove that the shared workload improved.

Keep the smallest change that resolves the demonstrated problem. Document any altered transaction semantics or operating requirements. The goal is dependable concurrency, not eliminating every table lock.

Lock escalation is not proof that SQL Server chose badly, it is a signal to examine transaction size and access patterns.

This post was rewritten from scratch in September 2026. The original, published on 2011-09-01, was a short announcement about something that no longer exists. The address is the same, the subject is now something worth keeping.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.

Best Practices, SQL Index, SQL Performance, SQL Server
Previous Post
SQL SERVER – Query to Find Duplicate Indexes – Script to Find Redundant Indexes
Next Post
How to Read a SQL Server Execution Plan

Related Posts

48 Comments. Leave new

  • Many Many happy returns to Shaivi…I pray to God for your family and you.I appreciate for you for each and every work you are doing for SQLAuthority.com..!

    Reply
  • Happy Birthday, Shaivi.. May god bless you with Happiness & Success.

    Happy Ganesa Chaturthi to Shaivi & Family :)

    Reply
  • Wish you many happy returns of the day Shaivi.
    May all your dreams come true.

    Thanks,
    Mitesh Modi

    Reply
  • Happy Birthday Shaivi! and Congrats on these wonderful milestones!

    Reply
  • Happy Birthday Shaivi..

    Pinal, really interesting things you are covered from past couple of days & waiting to grab my copy of this book ..

    All the best for your new articles :)

    Reply
  • Hi Sir,

    Bday wishes to ur lil angel and congrats for the release of your new book….:-)…

    Thanks for helping the sql community with your thought provoking blogs…

    happy ganesh chowti to you and your family….:)

    Best Regards,
    P.Anish Shenoy,
    INDIA, BANGALORE, KARNATAKA

    Reply
  • Partha Pratim Dinda
    September 1, 2011 4:58 pm

    Many many happy returns of day Shaivi.May god give you all the happiness and joy .
    Thanks Mr pinal to write such a good blog and congratulation for your new book release .

    After all happy Ganesh Chaturthi to all .

    A lots of love and wishes to the Angel (Shaivi) .
    Partha

    Reply
  • Congratulations Mr. Pinal! You have much to be proud of, Family, carreer and life. It is our love and passion that motivates us all. Thank you for sharing many precious things with us.

    Ron A. Farris
    Lexington, Kentucky, USA

    Reply
  • Wish you many many Happy returns of the day Shaivi.

    Reply
  • Hi Pinal,
    Happy birthday wishes to your daughter(Shaivi). Congratulations on the books, this is a neat achievement, writing a book is not a easy thing to do, finding the time, putting in the effort, hats off to you man.
    Happy Ganesh Chathurthi…

    Ramdas

    Reply
  • Nakul Vachhrajani
    September 2, 2011 10:31 am

    Wow! 3 wonderful events on the same day! Heartiest congratulations to you, Pinal, for being a great father & community contributor.
    Also, Many Happy Returns of the Day to Shaivi!

    Reply
  • Hi Pinal,

    Please pass my wishes to Shaivi, may god bless her :).

    In addition I would like you say thanks to you, as your innovative ideas are really great. Like these days we all are reading the article to answer the question and in this way we are learning new things each day.

    Further the articles are easy to understand , neat & clean language & description.

    Really Great Job.

    Thanks
    Hema Chaudhry

    Reply
  • Hello Pinal,

    First of all Happy birthday to Shaivi and congratulations for your huge success for your blog and your book.

    You are the best on blogging sphere.

    Best Regards,
    Jalpesh

    Reply
  • Happy Birthday to Shaivi.

    Reply
  • Krishna Prakash. H. N.
    September 2, 2011 3:06 pm

    Wish you many many Happy returns of the day your daughter(Shaivi)

    And

    Happy Ganesh Chathurthi to you and your family

    Reply
  • vishal patwardhan (@vishalpatwardha)
    September 3, 2011 11:54 am

    Be Lated Happy Birth Day Shaivi and pinal wish you and your family a Happy Ganesh Chaturathi.

    Reply
  • Happy Birthday, Shaivi. May GOD bring Shaivi as a great source of happiness and success for Pinal and his wife in coming life.
    No doubt I was not eligible to participate in Contest b/c I was from Pakistan, but I learn too much from this series. It is a great contribution to this Bog.

    Azhar Iqbal
    Lahore, Pakistan.

    Reply
  • Daniel Suárez
    March 2, 2012 12:14 am

    Nice article and great photos. Congratulations!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.