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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.