Reputation: 10245
I am wondering why setFetchBatchSize is used when fetching data from a coredata db is used and what the benefits of it are. I am currently just dropping a NSData blob into my coredata db, so I'm wondering if its applicable to me or if its used for nsarrays or something along those lines.
I have read what it says in apple docs but its not alot to go on.
The batch size of the receiver. A batch size of 0 is treated as infinite, which disables the batch faulting behavior.
dosn't help alot.. Currently I have disabled setFetchBatchSize and everything seems to still be working however I am wondering if I can benefit from it if I enable it.
Upvotes: 1
Views: 827
Reputation: 1840
If you have many records in your table (entity) and your fetch is set up to retrieve many records from this table, faulting is a method by which your app can preserve memory. Rather than retrieving all of these records and loading them into memory all at the same time, your fetchBatchSize will limit the number of records retrieved to that limit, and will fault the remaining records -- they will only be fetched when they are needed. If you set the fetchBatchSize this faulting will be handled for you automatically.
Hope this clarifies things a bit.
Upvotes: 5