I have a situation where I have to insert data in the database, and the data is very large which is in an ArrayList
. The data is inserted in a loop like this:
for( ..... )
ContentValues cv = new ContentValues();
// cv.put statements
sqLiteDB.insert ......
Now it takes around more than 1 minute in the test case and is expected to exceed 10 minutes with real data, while the target is to keep the time below 30 seconds. Data cannot be reduced. My questions are:
- How to improve the speed
- Is there a way to avoid repeated calls to sqLiteDB.insert function and do the insertion of all the rows in one batch?