NSFetchRequest pagination and fetchBatchSize interaction
0 reputation · 09 Oct 2024, 20:53 UTC
Implementing pagination for large datasets in Objective-C typically involves configuring an NSFetchRequest with fetchLimit and fetchOffset to retrieve specific data windows. To optimize memory usage, fetchBatchSize is often applied to prevent the immediate materialization of all objects in the result set.
There is uncertainty regarding the execution order when these properties are combined. Specifically, it is unclear if the batching mechanism operates on the total dataset before the limit is applied, or if it only batches the subset of records defined by the limit and offset.
- Does
fetchBatchSizereduce the memory footprint of the specific window defined byfetchLimit? - How does the interaction between these properties affect the generated SQL LIMIT and OFFSET clauses?