I have a stored procedure that's supposed to run every night. The procedure deletes data in batches of 10k rows, and between each batch issues a WAITFOR DELAY '00:00:02' with the intention of letting other processes do things in between batches (I didn't write this, this is the intention I was given).
The job ran and has been running for a while now. I ran sp_WhoIsActive and it shows this sp is suspened with the waitfor statement the sql text. Why would sql server keep this from processing further?
Additional information:
It's been running for over a day. It should have deleted 400k records, and has deleted 10k of them.
sp_whoIsActive output:
dd hh:mm:ss.mss 01 06:32:28.126
session_id 58
sql_text
login_name [redacted]
wait_info (131ms)WAITFOR
CPU 42,655,358
tempdb_allocations 7,981,282
tempdb_current 130
blocking_session_id NULL
reads 1,862,017,930
writes 26,792,391
physical_reads 273,169
locks
used_memory 4
status suspended
open_tran_count 0
percent_complete NULL
database_name [redacted]
program_name SQLAgent - TSQL JobStep (Job 0xA887960BA5034D4F89EEBDA2CB934921 : Step 2)
wait for
because it just happens to be what's going on when you look at the proc. Do those numbers keep going up if you keep checkingsp_whoisactive
?