The batch size of the objects specified in the fetch request.
- iOS 3.0+
- macOS 10.6+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
- Core Data
The default value is
0. A batch size of
0 is treated as infinite, which disables the batch faulting behavior.
If you set a nonzero batch size, the collection of objects returned when an instance of
NSFetch is executed is broken into batches. When the fetch is executed, the entire request is evaluated and the identities of all matching objects recorded, but only data for objects up to the
batch will be fetched from the persistent store at a time. The array returned from executing the request is a proxy object that transparently faults batches on demand. (In database terms, this is an in-memory cursor.)
You can use this feature to restrict the working set of data in your application. In combination with
fetch, you can create a subrange of an arbitrary result set.
For purposes of thread safety, when the fetch is executed, consider the array proxy returned as being owned by the managed object context the request is executed against. Treat the array proxy as if it were a managed object registered with that context.