Core Data or SQLite or Realm?

Core Data or SQLite or Realm?

Hello. I‘m confused on which database solution to use for my apps. 

Which one of the options is faster? Can they all handle large amounts of data? Can they all be used with a server? For instance, can I update the database on the phone with the database on the server easily? And most importantly, what are their different use cases?

Some say Core Data is more memory-efficient and some say Realm is faster (agilie.com/en/blog/coredata-vs-realm-what-to-choose-as-a-database-for-ios-apps). However, none of them are based on official information. They are all their respective writers’ opinions. I want official and trusted information, like a webpage from Apple’s or Realm’s website comparing different solutions, or a part of a WWDC session. Please provide me OFFICIAL INFORMATION.

Answers from Apple engineers especially the ones at WWDC20 are highly appreciated.

Tags: Core Data, iOS, Files and Storage, WWDC20 Community

I've used Core Data for over a decade, all of my Core Data apps have used SQLite in the background. I've also tried some apps with SQLite.swift and GRDB.swift.

Core Data is based on SQLite and should be able to handle large databases, but in my experience really slows down when you have a table with more than 10,000 rows. Not sure why. Also I'm not happy with the SQLite database underneath Core Data being off-limits. I can understand Apple's reasons. They want everything driven by their GUI leaving them free to optimize behind the scenes, but I'm trying to work on a synchronization with outside data.

SQLite.swift and GRDB.swift work, but not as cleanly as I'd like. However I haven't seen the slowdowns with my 80,000 row table that I've seen with Core Data.

I just started experimenting with MongoDB Realm. It's cloud sync looks more robust than Apple's Core Data / CloudKit sync, but I haven't hand enough time with it to be sure.

One worrying sign to me about Core Data. Past WWDC's have had many Core Data sessions. This year I only see two on the schedule. I was hoping for a more Swift-friendly update to Core Data this year. Doesn't look like it.

Unrelated to your question, but on a similar note, I don't see any Combine sessions on this year's schedule.

Past WWDC's have had many Core Data sessions.

Two seems pretty good to me. That’s the same as last year, and one more than the four years prior to that (links below).

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"

WWDC runs Mon, 22 Jun through to Fri, 26 Jun. During that time all of DTS will be busy with conference duties.



Core Data sessions in the last five years:
Hi adamek,

This link might help you. Be sure to read the first paragraph and the Binary Large Data Objects (BLOBs) section. The Fetching Managed Objects section also provides good tips on fetching objects.
@adamek how's your experience with Realm since 5 months ago? I'm actually thinking of switching from Realm to GRDB but not certain yet and would love your input (also vs SQLite.swift). Thanks!
Core Data or SQLite or Realm?
 
 
Q