I have Service Broker queue infrastructure that I am using in my database for a few months. I realized that my Initiator
queue has reached to 2 million records which are EndDialog
messages. So I re-designed it thanks to this link.
My problem is that I couldn't delete those 2 million records. I used the approach below as indicated in this link, and left the query executing. It executed for 20 hours until I canceled it.
declare @c uniqueidentifier
while(1=1)
begin
select top 1 @c = conversation_handle from dbo.queuename
if (@@ROWCOUNT = 0)
break
end conversation @c with cleanup
end
Now I am trying to drop Service and Queue but it seems it is gonna take lots of time again.
drop service initiatorService
drop queue initiatorQueue
Is there another way to delete immediately?