I'm using this library to perform bulk delete in batches like following:
while (castedEndedItems.Any())
{
var subList = castedEndedItems.Take(4000).ToList();
DBRetry.Do(() => EFBatchOperation.For(ctx, ctx.SearchedUserItems).Where(r => subList.Any(a => a == r.ItemID)).Delete(), TimeSpan.FromSeconds(2));
castedEndedItems.RemoveRange(0, subList.Count);
Console.WriteLine("Completed a batch of ended items");
}
As you can see guys I take a batch of 4000 items to delete at once and I pass them as argument to the query...
I'm using this library to perform bulk delete:
https://github.com/MikaelEliasson/EntityFramework.Utilities
However the performance like this is absolutely terrible... I tested the application couple of times and to delete the 80000 records for example it takes literally 40 minutes!?
I should note that that parameter by which I'm deleting (ItemID) is of varchar(400) type and it's indexed for performance reasons....
Is there any other library that I could possibly use or tweak this query to make it work faster, because currently the performance is absolutely terrible.. :/