The Locks object in Microsoft® SQL Server™ provides information about SQL Server locks on individual resource types. Locks are held on SQL Server resources, such as rows read or modified during a transaction, to prevent concurrent use of resources by multiple transactions. For example, if an exclusive (X) lock is held on a row within a table by a transaction, no other transaction can modify that row until the lock is released. Minimizing locks increases concurrency, which can improve performance. Multiple instances of the Locks object can be monitored at the same time, with each instance representing a lock on a resource type.
SQL Server can lock these resources.
Item | Description |
---|---|
RID | Row ID. Used to lock a single row within a table. |
Key | Row lock within an index. |
Page | 8 kilobyte (KB) data page or index page. |
Extent | Contiguous group of eight data pages or index pages. |
Table | Entire table, including all data and indexes. |
Database | Database. |
These are the SQL Server Locks counters.
SQL Server Locks counters | Description |
---|---|
Average Wait Time (ms) | Average amount of wait time (in milliseconds) for each lock request that resulted in a wait. |
Lock Requests/sec | Number of new locks and lock conversions per second requested from the lock manager. |
Lock Timeouts/sec | Number of lock requests per second that timed out, including internal requests for NOWAIT locks. |
Lock Wait Time (ms) | Total wait time (in milliseconds) for locks in the last second. |
Lock Waits/sec | Number of lock requests per second that could not be satisfied immediately and required the caller to wait. |
Number of Deadlocks/sec | Number of lock requests per second that resulted in a deadlock. |
Understanding Locking in SQL Server