Squeezing Performance from SQLite: Insertions (with Room)
Jason Feinstein
371

I think you should also benchmark iterating on items yourself and inserting them one by one inside your own transaction:

roomDatabase.beginTransaction();
try {
for (MyItem item : itemIterable) {
myDao.insert(item);
}
roomDatabase.setTransactionSuccessful();
}
finally {
roomDatabase.endTransaction();
}

This avoids the high memory usage issue you mentioned and if the performance is good enough, Room doesn’t even need built-in support for Iterables.