Hi i am trying to remove 4-5k rows from table using EF6 in .net mvc application
I am using RemoveRange for that, and if its 100-200 rows it completes in few seconds. But when i try to remove few thousands records it takes a very long time (10 min +)
using (someEntites dc = new someEntites())
{
var listForRemoval = (from a in dc.someTable
where a.Year == 2018 && a.month == 04
select a).ToList();
if (listForRemoval != null)
{
dc.someTable.RemoveRange(listForRemoval);
dc.SaveChanges();
}
}
i tried disabling AutoDetectChangesEnabled but that did not help.
Is there any other (relativly simple) way for removing larger chunks of data from db table ?
-- p.s writing simple delete - where in sql takes a second to complete