NSPredicate specify what you want to fetch • Target your search • Less I/O → better performance • Only bring in those objects you want • Core Data doesn’t have to pull in data you don’t need
Fetch as much as possible in 1 go NSPersistent StoreCoordinator NSManagedObjectContext NSManaged Object NSManaged Object NSManaged Object NSManaged Object NSPersistent Store SQLite File System
to bring objects into the context • Only do this when you need to. • Don’t fetch objects if they’re already in the context (or the persistent store coordinator’s row cache) • Measure • Don’t prematurely optimize
Not loading enough data • Inefficient queries These 3 are a problem in any database application, not just Core Data, but people like to blame Core Data.
NSManagedObjectContext NSManaged Object NSManaged Object NSManaged Object NSManaged Object NSPersistent Store NSPersistent Store NSPersistent Store SQLite File System SQLite File System
lot of complexity • Threading is always complex • You NEED a merging policy • You can almost always do without • Save yourself the trouble — go for simple