I have a nightly "archive and delete" process that writes all data from a large, busy table >150 days old to Blob storage, and deletes the same from the hosting table. The process performance is terrible - and in fact, it may take more than a day to delete a day's worth of data!
When I check for blocking, I see this process is almost always blocked by SPID "-5" ... my research tells me that this is an orphaned DT. However, when I run this:
SELECT DISTINCT(request_owner_guid) as UoW_Guid FROM sys.dm_tran_locks WHERE request_session_id =-5
It returns no rows.
There have been a few times where the performance of this operation deleted >30k a minute, which is great. So, something going on is transient but I can't pin it down. When it's in this state, the deletions take 10-30x longer.
Some background: This is an Azure SQL Managed Instance. I couldn't find a category just for that, so I posted in Azure SQL Databases, although I understand they are different.
How can I find out what SPID -5 is so I can fix the problem?
Thanks.