Skip to content
Advertisement

How to find out why the status of a spid is suspended? What resources the spid is waiting for?

I run EXEC sp_who2 78 and I get the following results:

results of sp_who2 for spid 78

How can I find why its status is suspended?

This process is a heavy INSERT based on an expensive query. A big SELECT that gets data from several tables and write some 3-4 millions rows to a different table.

There are no locks/ blocks.

The waittype it is linked to is CXPACKET. which I can understand because there are 9 78s as you can see on the picture below.

What concerns me and what I really would like to know is why the number 1 of the SPID 78 is suspended.

I understand that when the status of a SPID is suspended it means the process is waiting on a resource and it will resume when it gets its resource.

How can I find more details about this? what resource? why is it not available?

I use a lot the code below, and variations therefrom, but is there anything else I can do to find out why the SPID is suspended?

I already used sp_whoisactive. The result I get for this particular spid78 is as follow: (broken into 3 pics to fit screen)

enter image description here

Advertisement

Answer

SUSPENDED: It means that the request currently is not active because it is waiting on a resource. The resource can be an I/O for reading a page, A WAITit can be communication on the network, or it is waiting for lock or a latch. It will become active once the task it is waiting for is completed. For example, if the query the has posted a I/O request to read data of a complete table tblStudents then this task will be suspended till the I/O is complete. Once I/O is completed (Data for table tblStudents is available in the memory), query will move into RUNNABLE queue.

So if it is waiting, check the wait_type column to understand what it is waiting for and troubleshoot based on the wait_time.

I have developed the following procedure that helps me with this, it includes the WAIT_TYPE.

This query below also can show basic information to assist when the spid is suspended, by showing which resource the spid is waiting for.

Please see the picture below as an example:

enter image description here

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement