Sunday, 4 October 2026

Lock Hierarchy in SQL server

Lock Hierarchy is the mechanism SQL Server uses to organize locks from higher-level resources to lower-level resources. Instead of locking only rows, SQL Server places locks in a hierarchy:

Database à File à Table/Object à Page à Key/Row

When SQL Server acquires a lock at a lower level (Row/Key), it also places Intent Locks (IS, IX, SIX) at higher levels. This allows SQL Server to efficiently manage millions of locks and quickly determine lock compatibility.

Resource Types in Lock Hierarchy

Resource Type

Meaning

DATABASE

Entire Database

FILE

Data File

OBJECT

Table/View

PAGE

8 KB Page

KEY

Index Row

RID

Heap Row

EXTENT

64 KB Extent

HOBT

Heap/B-Tree Structure

ALLOCATION_UNIT

Storage Unit

No comments:

Post a Comment

If you have any doubt, please let me know.

Popular Posts