Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Core Data impose limits on the length of strings?

I was wondering if there are any limits on the length of strings stored using Core Data in iOS. (other than available RAM or disk space on the device)

like image 896
adriaan Avatar asked Apr 26 '12 01:04

adriaan


4 Answers

I think you're more likely to hit the performance limits on an iOS device before you hit any storage limits in Core Data. You'll also be getting a performance hit from pulling in large chunks of data.

You are better off, both in performance and manageability, breaking up large blocks of text into smaller chunks.

From what I remember Marcus Zarra telling me anyway.

like image 95
Abizern Avatar answered Nov 08 '22 16:11

Abizern


Just to confirm, that there are no specific limits in CoreData (not counting memory/disk space limitations). When using CoreData on iOS you are in almost every case using sqlite as persistent storage. CoreData stores String as Varchar and from sqlite's point of view:

SQLite does not enforce the length of a VARCHAR. You can declare a VARCHAR(10) and SQLite will be happy to store a 500-million character string there. And it will keep all 500-million characters intact. Your content is never truncated. SQLite understands the column type of "VARCHAR(N)" to be the same as "TEXT", regardless of the value of N.

...taken from sqlite's FAQ

like image 24
JakubKnejzlik Avatar answered Nov 08 '22 18:11

JakubKnejzlik


It does not have a limit as far as I can tell, unless you assign one in the model file (there is a section for min length and max length).

like image 3
borrrden Avatar answered Nov 08 '22 17:11

borrrden


I don't remember reading any limits in Core Data documentations, but remember that Core Data is just a framework on top of a real database, usually sqlite. I think it's safe to assume that the limits are dictated by the underlying DB.

like image 1
John Estropia Avatar answered Nov 08 '22 17:11

John Estropia