Reputation: 28268
There are times when i will need to delete say 10,000 rows from my CoreData data store and looping through those records individually each time takes way too long.
Is there a way to use SQL to directly delete from my data store quickly?
Upvotes: 0
Views: 211
Reputation: 2376
Modifying the CoreData store directly risks corrupting the database and is very highly discouraged. Your best bet is to delete with a CoreData query that is able to select all of the rows to be deleted at once.
When I say it risks corrupting, I don't mean that anything would be wrong with your SQL query, but that CoreData also inserts a lot of metadata into the database to help its indexing.
Upvotes: 1