Re: Efficient Updating of Thousands of NSManagedObject Relationships

2008-07-28 Thread Kenny Carruthers
Even building up an array of managedobjects and then passing that to the set returned from mutableSetValueForKey results in extremely long updates. For example, I just tried moving 1300 songs to a playlist and while it took almost no time to fetch each song from the managed context and buil

Re: Efficient Updating of Thousands of NSManagedObject Relationships

2008-07-28 Thread I. Savant
> for (song in songs) > NSManagedObject *song = ... (Fetch some from proper context) > song.playlist = destinationList > end You could always ask the playlist for its -mutableSetValueForKey:@"songs" ... then call -addObjects: and pass in your songs array. -- I.S. _

Efficient Updating of Thousands of NSManagedObject Relationships

2008-07-28 Thread Kenny Carruthers
Given an array of NSManagedObjects, is there an efficient way to batch update a relationship on each object? Iterating through the array and setting the relationship using any of the available methods is incredibly slow when doing this on thousands of objects. As an example, assume