Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Core Data and SQLite [closed]

What is the basic difference between Data and SQLite, as both are databases and can be used with iOS development. Which is better for saving and retrieving large data?

like image 848
TalaT Avatar asked Jul 12 '11 12:07

TalaT


People also ask

Is Core Data based on SQLite?

Although Core Data supports SQLite as a store type, the store format—like those of the other native Core Data stores—is private. You cannot create a SQLite database using the native SQLite API and use it directly with Core Data, nor should you manipulate an existing Core Data SQLite store using native SQLite API.

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.

What database does Core Data use?

The persistence part of Core Data is backed by SQLite, which is a relational database.


2 Answers

There is a huge difference between these two.

SQLite is a database itself like we have MS SQL Server.

But Core Data is an ORM (Object Relational Model) which creates a layer between the database and the UI. It speeds-up the process of interaction as we don't have to write queries, just work with the ORM and let ORM handles the backend.

For saving or retrieving large data, I recommend to use Core Data because of its abilities to handle the lower processing speed of iOS devices. Hope this helps.

@Arundhati: Using Core Data we can optimize the memory efficiently.

Regards.

like image 74
Wasim Avatar answered Sep 21 '22 04:09

Wasim


Apart from being ORM (Object Relational Model) You can compare Core-Data and SQLite as;

SQLite:

  • Have Data Constrains feature.
  • Operates on data, stored on disk.
  • Can Drop table and Edit data without loading them in memory.
  • Slow as compared to core data.

Core Data:

  • Don't have Data Constraints,if required need to implement by business logic.
  • Operates on in memory.(data needs to be loaded from disk to memory)
  • Need to load entire data if we need to drop table or update.
  • Fast in terms of record creation.(saving them may be time consuming)

Additionally apart from SQLite as back-end Core data can use XML or binary format for storing data to disk.

like image 36
mhrrt Avatar answered Sep 23 '22 04:09

mhrrt