Skip navigation.
 
mlCoreData - Fast Deletion Of Thousands Of ManagedObjects?
FROM : Simon Liu
DATE : Tue Dec 20 17:32:15 2005

I have a tableview representing managed objects.  If I select all the
managed objects e.g.10,000, and delete them from the
managedObjectContext, there is a long delay e.g. 30 seconds.

Is there a way to delete large numbers of objects from a context
quickly and avoid the spinning beach ball?  I don't really want to
have to delete the objects in a background thread, or put up a panel
saying 'Deletion in progress'.

My managed objects have relationships with nullify and cascade
deletion rules.  My deletion code looks something this:

   id undoManager = [[context undoManager] retain];
   [context setUndoManager:nil];
   
   while (obj = [enumerator nextObject]) {
          [context deleteObject:obj];
   }
   
   [context setUndoManager:[undoManager autorelease]];

Appreciate any tips.  Thanks.
--Simon

Related mailsAuthorDate
mlCoreData - Fast Deletion Of Thousands Of ManagedObjects? Simon Liu Dec 20, 17:32
mlRe: CoreData - Fast Deletion Of Thousands Of ManagedObjects? Justin Burns Dec 20, 20:30
mlRe: CoreData - Fast Deletion Of Thousands Of ManagedObjects? mmalcolm crawford Dec 20, 20:38
mlRe: CoreData - Fast Deletion Of Thousands Of ManagedObjects? Chris Hanson Dec 20, 21:03
mlRe: CoreData - Fast Deletion Of Thousands Of ManagedObjects? Simon Liu Dec 20, 23:25
mlRe: CoreData - Fast Deletion Of Thousands Of ManagedObjects? pyunpyun Dec 21, 04:21
mlRe: CoreData - Fast Deletion Of Thousands Of ManagedObjects? mmalcolm crawford Dec 21, 05:24
mlRe: CoreData - Fast Deletion Of Thousands Of ManagedObjects? pyunpyun Dec 21, 18:52