bulk inserts with SQLite and CoreData bulk inserts with SQLite and CoreData sqlite sqlite

bulk inserts with SQLite and CoreData


You can specify the pragmas when adding your store to the store coordinator:

NSMutableDictionary *pragmaOptions = [NSMutableDictionary dictionary];[pragmaOptions setObject:@"OFF" forKey:@"synchronous"];[pragmaOptions setObject:@"OFF" forKey:@"count_changes"];[pragmaOptions setObject:@"MEMORY" forKey:@"journal_mode"];[pragmaOptions setObject:@"MEMORY" forKey:@"temp_store"];NSDictionary *storeOptions =    [NSDictionary dictionaryWithObject:pragmaOptions forKey:NSSQLitePragmasOption];NSPersistentStore *store;NSError *error = nil;store = [psc addPersistentStoreWithType:NSSQLiteStoreType            configuration: nil            URL:url            options:storeOptions            error:&error];

(Adapted from Persistent Store Features)

I strongly suggest to also read "Efficiently Importing Data".

Related documentation:NSSQLitePragmasOptionEfficiently Importing Data