Which sessionid has the most locks in a SQL Server instance

Which sessionid has the most locks in a SQL Server instance

  • Comments 2

Quick post today. Was playing around with something on Friday night, thinking how to answer this question quickly whilst looking a live performance problem. I have a huge selection of ready to go DMV based queries, aimed at targetting all types of performance problems, but this was one I didn't have. The answer of course is beautifully simple through the magic of DMVs. Do you remember when these didn't exist? Sometimes it's easy to forget :-) The answer and a good one to have in your troubleshooting code toolbox:

select request_session_id, count(*)

from sys.dm_tran_locks

group by request_session_id

Leave a Comment
  • Please add 2 and 4 and type the answer here:
  • Post
Page 1 of 1 (2 items)