Locks
Locks provide the isolation aspect of transactions. They are acquired on data resources to prevent data inconsistency problems. SQL Server allows you to control the level of consistency you will get from your data by setting the isolation level of your session or query. I’ll cover isolation levels later in the chapter. In this section, I’ll focus on locks.
Locks can be obtained on resources at different granularity levels of data. The smallest granularity of data is the row level. If a row of a heap is locked (a heap is a table without a clustered index), the locked resource is a row identifier (RID). If a row in an index is locked, the locked resource is a key. A lock can also be obtained on a page, an extent, a table, and on other types ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access