I have an entity Word with keyword is a uniqueConstraint of type String. Now I have to import large amount (>100000 records) of Words with new keywords from a text file. I tried to create coredata NSManagedObject and insert into context with NSPolicyObjectTrump to merge new keywords with the old ones. But unfortunately, my saving project on context goes slow (2-3 minutes) because of coredata’s resolving conflict process. So which is the best approach to import such a large amount of project and make sure that no uniqueConstraint on coredata be violated? Should I pre-create sqlite and how to migrate sqlite files with the same object model? Thank you
Split the array into many slices. Each slice should be around 200 items. You should test and tweak this number to find the right batch size for your application, but this number has worked for me in my own applications.
Make an operation queue and an operation for each slice, so you can process each slice, one at a time
For each slice that needs to be processed: