I have a following setup:
- Table1 - 150k rows currently, need to add another 25k rows,
- Table2 - 300k rows, need to add another 50k.
I add rows in a loop, like that (EF code first):
using (var context = new MyDb())
{
loop() //25k rounds
{
var t3 = new Table2();
var t2 = new Table2();
var t1 = new Table1{prop1 = t2, prop2 = t3};
context.Table1.Add(t1);
context.SaveChanges();
}
}
So, the loop will take 25k turns in total, and my performance measurement shows me, that it will add those rows in roughly ten hours! And now I have no idea if it is because this is a normal time for this kind of operation with EF, or because there is something wrong with my dbms?