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 ...

Get Inside Microsoft® SQL Server™ 2005 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.