kevin
kevin

Reputation: 75

Managing large databases on iPhone devices: simple sqlite3 coding or CoreData?

I have to manage a table on a large database with over 20k records (the db size is 25MB). I use standard queries like SELECT\INSERT etc. programmatically using SQLITE framework. But the app on the Device is VERY VERY slow. When I tap the icon, the Default.png freezes for 10-20 seconds and the app crashes. When I run it on the simulator (and when I build on the device from Xcode), the app does not crash but it takes too much time for loading and it's very slow to change views.

Is that a SQLITE problem? Can SQLITE manage large databases? If not I think I will have to migrate to the CoreData APi. If yes, I have to investigate on coding bugs...

Any help would be appreciated. Thank you!

Upvotes: 2

Views: 609

Answers (3)

MPelletier
MPelletier

Reputation: 16709

I don't want to ruin your date, Kevin, but have you tried either bulk inserting (assuming this is possible on iPhone) or nesting your inserts in a transaction? Making every insert atomically will mean each is a transaction, and there will be a loss there (recalculate the btrees of each index every isert, etc).

Upvotes: 0

Roger
Roger

Reputation: 15813

Let coredata be your friend, I have an app with triple your data set and it runs as fast as you like.

Upvotes: 1

Jeff Kelley
Jeff Kelley

Reputation: 19071

The fact that your app crashes on launch and is slow to launch leads me to believe you're running out of memory. Are you by any chance loading the database file into memory?

Upvotes: 0

Related Questions