title: Batching Core Data fetch results
body: <p>I'm executing a fetch request that returns about 2000 entities. Currently, this takes about 20 seconds on my device. So I thought I might set a fetch limit of 100, and then when the user scrolls to the end of the table view, fetch the next 100 entities. This can be accomplished using <code>NSFetchRequest's</code> <code>setFetchLimit</code> and <code>setFetchOffset</code>. </p>
  
  <p>However, what I can't figure out is, if on my second fetch where I'm fetching objects 101-200, what would happen to the objects 1-100? Would I have to use separate <code>NSFetchedResultsController</code> for every 100 items, and then configure my table view data source methods to query based on multiple fetch results controllers? Or can I somehow use the same <code>NSFetchedResultsController</code> to somehow fetch 100 entities at a time, but upon every subsequent fetch, just add the next 100 items to the original 100 items?</p>
  
  <p>Edit: Here's my code:</p>
  
  <pre><code>    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
  
      NSEntityDescription *entity = [NSEntityDescription 
                                     entityForName:@"MessageObject" inManagedObjectContext:appDelegate.managedObjectContext];
  
      [fetchRequest setEntity:entity];
      NSPredicate *predicate= [NSPredicate predicateWithFormat:@"ANY tags.tagName==%@", currentTagObject.tagName];
      [fetchRequest setPredicate:predicate];
      NSSortDescriptor *sort= [[NSSortDescriptor alloc] initWithKey:@"createDate" ascending:NO selector:@selector(compare:)];
      [fetchRequest setSortDescriptors:[NSArray arrayWithObject:sort]];
      [fetchRequest setFetchBatchSize:5];
  </code></pre>