2

We are seeing parallelism causing worker thread shortage in SQL,while investigating we found session id is null for some sessions,Below is the query used.What does this session id null means ?

select session_id,count(*) as 'totalthreads' from sys.dm_os_tasks
group by session_id
having count(*)>1
order by totalthreads desc

Output varies as below:

enter image description here

enter image description here

  • The session_id in sys.dm_os_tasks specify the "ID of the session that is associated with the task" mostly it comes if your "task_state" is Done. – Md Haidar Ali Khan Sep 22 '15 at 8:51
2

The session is sleeping if the session_id value of sys.dm_os_tasks is NULL. This is stated in the link above under the Examples section: Associating Session IDs with Windows threads.

The following query does not return information for sessions that are sleeping.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.