Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite or Core Data for large database with only queries

Basically, I'm writing an iOS app that makes use of a huge database that will not be edited at all. Between these two, I'm looking for faster query speeds. I have never used any SQLite or Core Data in my developing lifetime, so before I take a dive writing anything, I want to find out which of these (or if any alternatives) would be better for my task.

Any performance data or suggestions would be greatly appreciated.

Edit: Neither SQLite nor Core Data was able to deliver the performance I needed (although SQLite performed better). I decided to go with SQLite (with FMDB) and use multi-threading to get rid of stutters that occur when querying multiple times.

like image 916
Jay Avatar asked Feb 02 '13 05:02

Jay


People also ask

Why Core Data is faster than SQLite?

Core Data is heavily optimized with regards to caching, lazy-loading and memory management. If you use it (with the SQLite store type), especially in conjunction with NSFetchedResultsController, you should get better performance than you could get with SQLite on your own.

Is Core Data equal to SQLite?

The most important difference between Core Data and SQLite is that SQLite is a database while Core Data is not. That is the most important difference because there is very little to compare. Core Data and SQLite are solutions to different problems.

Why realm is faster than Core Data?

Realm uses its own engine, simple and fast. Thanks to its zero-copy design, Realm is much faster than ORM, and often faster than SQLite either.

Is realm faster than Core Data?

Core Data is incredibly fast if you consider what it does under the hood to do its magic. But Realm is faster, much faster. Realm was built with performance in mind and that shows. As Marcus Zarra once said in a presentation, you don't choose Core Data for its speed.


2 Answers

It depends on how you want to manage your data, if you want a relational database, use sqlite and if you want to save model objects (in the sense of the model-view-controller design pattern) to a file and get them back again, use Core Data.

According to me both are same for large database, in sqlite you can use transactions for getting huge data faster.

This link might helps you better.

Hope this helps you..

like image 119
P.J Avatar answered Oct 12 '22 11:10

P.J


For me I will always use core data whenever possible. As it is easy to use and manage. For more you can check these links

  1. Core Data vs SQLite 3
  2. Use CoreData or SQLite on iPhone

Here are good tutorials of Ray Wenderlich on Core Data

  1. Core Data on iOS 5 Tutorial: Getting Started
  2. Core Data Tutorial: How To Preload/Import Existing Data
like image 27
Inder Kumar Rathore Avatar answered Oct 12 '22 12:10

Inder Kumar Rathore