简体   繁体   中英

Opening connection to SQLITE database on iPhone too slow

I have created a simple iPhone/iPad app which reads some data from a SQLITE database and shows it on the screen. The database is added to the Xcode project and only needs to be read (not written). In the simulator all this works fine, but when I run this app on my iPhone it is too slow.

I have added some performance profiling to the app, so I was able to determine which part of the app was slow. It appears that opening the connection to the database takes about 0.8 - 0.9 second on the iPhone and about 0.004 second on the iPad. I tested with the SQLLITE framework and also with the FMDB wrapper, but the results were the same.

Why is it so slow on the iPhone? Is there a way to improve the performance?

Thanks, Danny

How often are you opening it? If you can open it once, and just keep that handle open and reuse it, that would likely solve your problem.

Or is it that this single instance of it opening is too great of a burden?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM