Is there a way to improve the performance of SaveAll? (I am finding that on large data sets (ie 10-100K rows) trying an insert, catching the primary key exception, and issuing an update within the catch is significantly faster than SaveAll, even when most of the operations need to be updates. I have experienced this with both MySQL/MariaDB and SQL Server across various managed cloud database services)
this is the pattern I a have evolved too but it seems silly to do as a workaround, but it is at least 4x faster in my testing across a broad set of updates and insert data sets.
try{
Db.InsertAll(recs);
}
catch(Exception e)
{
try{
Db.UpdateAll(recs);
}
catch(Exception e2)
{
foreach(var rec in recs)
{
try{
Db.Insert(rec);
}
catch(Exception e3)
{
try{
Db.Update(rec);
}
catch(Exception e4)
{
Log.Error("Error updating a single record",e);
}
}
}
}
}