I have been playing with different ways of inserting 5000 records into sqlite like using execSql
& insert
methods on SQLiteDatabase
object and compiled statements. In all the cases the inserts (actually insert or replace) are made inside a single transaction.
When using compiled statements the average insertion time is approximately 3000 milliseconds for 5000 records. In case of insert() method the average time hovers around 4500 milliseconds and for execSql() it is approximately 5000 milliseconds.
I was expecting sqlite to be a lot faster. In the official website, it is stated that on an average, a desktop computer can handle 50,000 inserts per second (in a transaction). Even though the test device I am using isn't a particularly powerful one (Galaxy S3 mini), I expected the SSD storage to offset any disadvantages and provide ~20,000 inserts per second. Alas!! That doesn't seem to be the case.
Am I doing something wrong or is this the max performance that can be eked out of a mobile device?
EDIT 1
All the records have 14 columns and they are a mixture of text & numbers (most are uuids or urls)