About Making Batch Changes

In certain situations, it may be necessary to make extensive alterations to the persisted data of an app. When these situations occur, it is advisable to make these changes against the data on disk rather than in memory with objects.

There are two types of batch operations: batch updates and batch deletes.

At a Glance

Both batch updates and batch deletes are developed in a similar manner to a NSFetchRequest. Executing either a batch delete or a batch update blocks the NSManagedObjectContext that it is being run just as occurs with a NSFetchRequest. However, because both batch updates and batch deletes are executed directly against the SQLite persistent store, they execute far more quickly compared to performing the same changes or deletes in memory.

How to Use This Document

Use this guide as a reference and as an implementation strategy when implementing batch updates or batch deletes. Follow the strategies and best practices presented in this guide to handle large changes to your persistent store and to avoid common pitfalls.

Prerequisites

You should be comfortable with the Core Data framework before implementing batch updates or batch deletes. To learn about the basic features of Core Data, read Technology Overview in the Core Data Programming Guide.

See Also

You’ll find other excellent resources in Apple’s developer libraries. Here are a two whose topics are related to the content of this document.