core data - Can I use NSBatchDeleteRequest on entities with relationships that have delete rules? -


i'm attempting use nsbatchdeleterequest delete pile of entities, many of these entities have delete cascade and/or nullify rules.

my first attempt delete fails , nserror includes string "delete rule not supported batch deletes". had thought fine delete such things responsible making sure constraints satisfied before save.

should able batch delete these managed objects? (i want keep delete rules, other delete paths don't have easy way know set of objects delete) kinds of batch deletes work in case, others not? (say predicates fail, list of object ids work?)

batch delete problematic relationships.

it goes directly database , deletes records suspending object graph rules, including delete rules. have correctly identified requirement need constraint checking again. (that deal-breaker.)

even if manage delete entities , necessary related entities correctly, still left lots of entries in (opaque) join table core data creates in background. there no obvious safe way delete entries in join tables , have been reported interfere managing relationships in future operations.

imo , solution in case still use object graph rather batch delete , optimize performance. there many answers on sof on how this, of can summarized these points:

  • find right batch size saving (typically 500 entities creation, 2000 deletion, vary according object size , relationship complexity - have experiment).
  • if have memory constraints, use autoreleasepools.
  • use background context free ui interaction. prefer saving database in background after updating ui.

Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -