I configure the NSFetchedResultsController, set the batch size in the request, and fetch.
Depending on performance, memory usage, logging (each time you access the attribute of an object) and SQL logging (without mentioning the restrictions in the SQL query), it is obvious that fetchBatchSize is ignored and that all my objects are ears).
What could be the reason for ignoring this parameter?
NSFetchRequest *request = [NSFetchRequest new];
NSEntityDescription *entity = [NSEntityDescription entityForName:entityName inManagedObjectContext:context];
[request setEntity:entity];
[request setSortDescriptors:[[NSSortDescriptor alloc] initWithKey:@"dateCreated" ascending:NO]];
[request setFetchBatchSize:50];
self.fetchController = [[NSFetchedResultsController alloc]
initWithFetchRequest:request
managedObjectContext:context
sectionNameKeyPath:nil
cacheName:nil];
NSError *error;
[self.fetchController performFetch:&error];
Please note that if I set a breakpoint just before the fetch, the query will indeed be set with a batch size limit of 50; but SQL registration does not mention this.
source
share