Reputation: 2038
I am adding about 3000 rows to SQLite database and it takes about 8 seconds. How can I optimize this.
Upvotes: 0
Views: 1262
Reputation: 60681
If you aren't already, wrap the entire operation in a transaction. Your code should look something like this:
db.beginTransaction();
try {
// insert your data here
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
Upvotes: 3
Reputation: 234807
Try executing PRAGMA synchronous = OFF
before doing the updates.
Upvotes: 1