LCK_M_RIn_S SQL Server Wait Type

Wait Type LCK_M_RIn_S

The wait type LCK_M_RIn_S is ranked #250 by Stedman Solutions and Database Health Monitor.

Wait statistics, in the context of SQL Server, refer to the amount of time that a query spends waiting to access data in the database. When a client application requests data from the database, the request is placed in a queue and the client application must wait for its turn to access the data. The time that the query spends waiting is called a "wait" and is tracked by SQL Server. This information can be used to identify potential performance bottlenecks and optimize the performance of the database. Wait statistics are commonly used by database administrators to diagnose and troubleshoot performance issues in SQL Server.


In SQL Server, locks are essential for maintaining data integrity in multi-user environments. They help ensure that operations like reads and writes don’t conflict with each other. However, when locks block other processes, SQL Server records a wait type to indicate the cause of the delay. One such wait type is LCK_M_RIn_S, which occurs when a process is waiting for a Range Intent Shared (RIn_S) Lock. In this blog post, we’ll explain what this wait type means, when it occurs, and how to address it.

What Is the LCK_M_RIn_S Wait Type?

The LCK_M_RIn_S wait type indicates that a process is waiting for a Range Intent Shared Lock. This type of lock is used in scenarios where SQL Server needs to protect a range of rows during certain operations, such as reading data while ensuring no other process modifies or deletes rows within that range.

For example, if a query involves reading data within a range (e.g., using a WHERE clause), SQL Server may place a RIn_S lock to prevent other transactions from performing operations that would affect the range’s integrity.

When Does LCK_M_RIn_S Appear?

This wait type commonly occurs in the following scenarios:

  • Range Queries with Concurrency – Queries that read a range of rows (e.g., using BETWEEN or LIKE) may encounter LCK_M_RIn_S waits when another transaction is modifying rows in the same range.
  • High-Concurrency Workloads – Environments with many concurrent read and write operations on the same table or index.
  • Serializable Isolation Level – When transactions are running in the Serializable isolation level, SQL Server uses range locks to ensure strict data consistency, leading to LCK_M_RIn_S waits.

Why LCK_M_RIn_S Waits Matter

While some LCK_M_RIn_S waits are normal in high-concurrency systems, excessive or prolonged waits can lead to performance bottlenecks. Common causes include:

  • Contention Between Transactions – Multiple transactions competing for locks on overlapping ranges.
  • Large Transactions – Transactions that lock a large range of rows or hold locks for a long time, blocking other processes.
  • Poor Query Design – Queries that unnecessarily scan large ranges of data, increasing the likelihood of lock contention.
  • Inappropriate Isolation Levels – Using the Serializable isolation level for transactions that don’t require such strict consistency.

How to Address LCK_M_RIn_S Waits

If LCK_M_RIn_S waits are affecting your SQL Server environment, consider these strategies to reduce their impact:

  • Optimize Queries – Review and optimize queries to reduce the range of rows being scanned. For example, use indexes or rewrite queries to limit the rows affected.
  • Use Appropriate Isolation Levels – Avoid using the Serializable isolation level unless it’s absolutely necessary. Consider Read Committed Snapshot Isolation (RCSI) or Snapshot Isolation for better concurrency.
  • Break Large Transactions into Smaller Batches – Divide large transactions into smaller, more manageable units to reduce the time locks are held.
  • Monitor and Resolve Blocking – Use tools like sp_who2, Activity Monitor, or sys.dm_exec_requests to identify and resolve blocking sessions causing LCK_M_RIn_S waits.
  • Implement Proper Indexing – Ensure indexes are in place to help queries locate rows efficiently, minimizing the need for range scans and locks.

Monitoring LCK_M_RIn_S Waits

To monitor LCK_M_RIn_S waits, use SQL Server tools like sys.dm_os_wait_stats to track wait statistics. Additionally, tools like Database Health Monitor can help you identify blocking sessions and analyze queries contributing to lock contention.

Conclusion

The LCK_M_RIn_S wait type in SQL Server occurs when a process is waiting for a Range Intent Shared lock, typically to protect a range of rows during a read operation. While these waits are expected in certain scenarios, frequent or prolonged waits can indicate performance issues such as high contention, large transactions, or poor query design. By optimizing queries, adjusting isolation levels, and monitoring for blocking, you can reduce LCK_M_RIn_S waits and improve overall system performance.

If you need assistance with SQL Server performance tuning, query optimization, or resolving lock contention issues, Stedman Solutions offers managed services to ensure your SQL Server environment runs efficiently and reliably.


Find out more about our SQL Server Managed Services

Applies to

    Related Waits

    LCK_M_BU
    LCK_M_BU_ABORT_BLOCKERS
    LCK_M_BU_LOW_PRIORITY
    LCK_M_IS
    LCK_M_IS_ABORT_BLOCKERS
    LCK_M_IS_LOW_PRIORITY
    LCK_M_IU
    LCK_M_IU_ABORT_BLOCKERS
    LCK_M_IU_LOW_PRIORITY
    LCK_M_IX
    LCK_M_IX_ABORT_BLOCKERS
    LCK_M_IX_LOW_PRIORITY
    LCK_M_RIn_NL
    LCK_M_RIn_NL_ABORT_BLOCKERS
    LCK_M_RIn_NL_LOW_PRIORITY
    LCK_M_RIn_S_ABORT_BLOCKERS
    LCK_M_RIn_S_LOW_PRIORITY
    LCK_M_RIn_U
    LCK_M_RIn_U_ABORT_BLOCKERS
    LCK_M_RIn_U_LOW_PRIORITY
    LCK_M_RIn_X
    LCK_M_RIn_X_ABORT_BLOCKERS
    LCK_M_RIn_X_LOW_PRIORITY
    LCK_M_RS_S
    LCK_M_RS_S_ABORT_BLOCKERS
    LCK_M_RS_S_LOW_PRIORITY
    LCK_M_RS_U
    LCK_M_RS_U_ABORT_BLOCKERS
    LCK_M_RS_U_LOW_PRIORITY
    LCK_M_RX_S
    LCK_M_RX_S_ABORT_BLOCKERS
    LCK_M_RX_S_LOW_PRIORITY
    LCK_M_RX_U
    LCK_M_RX_U_ABORT_BLOCKERS
    LCK_M_RX_U_LOW_PRIORITY
    LCK_M_RX_X
    LCK_M_RX_X_ABORT_BLOCKERS
    LCK_M_RX_X_LOW_PRIORITY
    LCK_M_S
    LCK_M_S_ABORT_BLOCKERS
    LCK_M_S_LOW_PRIORITY
    LCK_M_SCH_M
    LCK_M_SCH_M_ABORT_BLOCKERS
    LCK_M_SCH_M_LOW_PRIORITY
    LCK_M_SCH_S
    LCK_M_SCH_S_ABORT_BLOCKERS
    LCK_M_SCH_S_LOW_PRIORITY
    LCK_M_SIU
    LCK_M_SIU_ABORT_BLOCKERS
    LCK_M_SIU_LOW_PRIORITY
    LCK_M_SIX
    LCK_M_SIX_ABORT_BLOCKERS
    LCK_M_SIX_LOW_PRIORITY
    LCK_M_U
    LCK_M_U_ABORT_BLOCKERS
    LCK_M_U_LOW_PRIORITY
    LCK_M_UIX
    LCK_M_UIX_ABORT_BLOCKERS
    LCK_M_UIX_LOW_PRIORITY
    LCK_M_X
    LCK_M_X_ABORT_BLOCKERS
    LCK_M_X_LOW_PRIORITY

    See Also


    All Wait Types
    LCK_M_RIn_S SQL Server Wait Type