How to insert 40000 records fast into an sqlite database in an iPad

前端 未结 2 954
旧巷少年郎
旧巷少年郎 2020-12-03 02:09

I want to insert 40000 records that i get from a web service into a sqlite database in my iPad app.

I wrote the following code, but it takes around 20 minutes, is th

2条回答
  •  旧巷少年郎
    2020-12-03 02:58

    For me, calling BEGIN TRANSACTION then loading some 20 inserts, then calling COMMIT TRANSACTION gave an 18x performance increase - great tip! Caching the prepared statements was little help.

提交回复
热议问题