Datarows locking

In datarows locking, row-level locks are acquired on individual rows on data pages. Index rows and pages are not locked. When a row is changed on a data page, a nontransactional latch is acquired on the page. The latch is held while the physical change is made to the data page, then the latch is released. The lock on the data row is held until the end of the transaction. The index rows are updated, using latches on the index page, but are not locked. Index entries are implicitly locked by acquiring a lock on the data row.

Figure 1-3 shows an insert into a datarows-locked table. Only the affected data row is locked.

Figure 1-3: Locks held during datarows locking

Two images showing an insert in to a datarows-locked table, with only the affected datarow locked.