We had a lot of data at QueueItems table from orchestrator database and that was making our performance slow. We went for info from https://orchestrator.uipath.com/docs/maintenance-considerations#section-using-sql-server-maintenance-solution and that database query can filter by creation time, status and/or tenant. It was really useful but we still were having timeout issues. We keep looking into database and we found out there are QueueItems (transactions) related to deleted Queues (Deleted queues can not been recover from orchestrator web interface), so those QueueItems could be deleted from database.
We want to share a query to delete those “deleted” QueueItems:
delete FROM DBO.QueueItems WHERE ID IN (select qi.Id FROM DBO.QueueItems qi inner join QueueDefinitions qd on qi.QueueDefinitionId=qd.Id WHERE qd.IsDeleted=1)
if you have a lot of QueueItems you can delete by slots:
delete FROM DBO.QueueItems WHERE ID IN (select TOP 1000 qi.Id FROM DBO.QueueItems qi inner join QueueDefinitions qd on qi.QueueDefinitionId=qd.Id WHERE qd.IsDeleted=1)
Remember to do a backup before.
We would like to receive some feedback about this query, let us know how can we improve it or if you don’t recommend it’s use.
Juan Felipe Carvajal