Inventory Open Cursors per Session with sys.dm_exec_cursors
Nov 3, 2026 / · 9 min read · sys.dm_exec_cursors sys.dm_exec_sessions sys.dm_exec_sql_text sys.dm_exec_requests sys.dm_exec_xml_handles sql server cursors dmv monitoring tsql tempdb ·If code declares a GLOBAL cursor and never deallocates it, the cursor stays allocated until the connection closes. While it stays open it can hold tempdb space, row locks or both. The collector query below snapshots every cursor on the instance with its properties, state, I/O and idle time, and a short follow-up query …
Read MoreRank Index Contention with sys.dm_db_index_operational_stats
Oct 22, 2026 / · 7 min read · sql server sys.dm_db_index_operational_stats sys.indexes sys.dm_os_wait_stats sys.dm_db_index_usage_stats lock contention row locks blocking indexes performance tuning dmv tsql ·Once sys.dm_os_wait_stats points to locking, the next question is which index the waits belong to. The script below reads sys.dm_db_index_operational_stats for the current database and ranks each user-table index by its number of row-lock waits. Next to each count it returns the share of row-lock requests that had to …
Read More