Skip navigation.
 
mlre: Core Data performance advice... creating relationships.
FROM : Ben Trumbull
DATE : Tue Jan 15 23:50:30 2008

Martin,

Looking at the Instruments snapshot, one can see most of the time is
spent maintaining the inverse relationship as that is triggering
faulting of unloaded data.

When you dirty a managed object for the first time, we need its
current data to establish a snapshot.  The snapshot is used for
several features including undo, merge policies & conflict detection,
and the committedValuesForKeys/changedValues methods.  This includes
the identities (but not full data) of object's current relationships.

For to-many relationships, this can trigger additional faulting (in
database terms, a fetch against the join table)

You can address the problem by prefetching Foo's to-many
relationships during your initial fetch.  If Bar has other to-many
relationships, you'll want to prefetch those in the fetch request for
"bar where ID = X"

The Instruments set you used doesn't include all the Core Data
instruments from the main template, specifically "Core Data Cache
Misses", so Instruments isn't high lighting the specific problem as
well as it could.

If you add that instrument, you should see both the entity and
relationships that are being faulted.
--

-Ben

Related mailsAuthorDate
mlCore Data performance advice... creating relationships. Martin Linklater Jan 14, 22:43
mlRe: Core Data performance advice... creating relationships. Scott Ellsworth Jan 14, 22:56
mlRe: Core Data performance advice... creating relationships. I. Savant Jan 14, 23:04
mlRe: Core Data performance advice... creating relationships. I. Savant Jan 14, 23:12
mlRe: Core Data performance advice... creating relationships. Martin Linklater Jan 14, 23:18
mlRe: Core Data performance advice... creating relationships. Martin Linklater Jan 15, 00:10
mlRe: Core Data performance advice... creating relationships. marcelo.alves Jan 15, 02:57
mlre: Core Data performance advice... creating relationships. Ben Trumbull Jan 15, 05:22
mlRe: Core Data performance advice... creating relationships. Phil Jan 15, 10:15
mlre: Core Data performance advice... creating relationships. Martin Linklater Jan 15, 10:21
mlRe: Core Data performance advice... creating relationships. Martin Linklater Jan 15, 10:37
mlRe: Core Data performance advice... creating relationships. Chris Hanson Jan 15, 10:56
mlRe: Core Data performance advice... creating relationships. Martin Linklater Jan 15, 11:31
mlRe: Core Data performance advice... creating relationships. Phil Jan 15, 12:46
mlRe: Core Data performance advice... creating relationships. I. Savant Jan 15, 13:07
mlRe: Core Data performance advice... creating relationships. I. Savant Jan 15, 13:14
mlRe: Core Data performance advice... creating relationships. Sean McBride Jan 15, 16:31
mlRe: Core Data performance advice... creating relationships. Phil Jan 15, 17:14
mlRe: Core Data performance advice... creating relationships. mmalc crawford Jan 15, 17:21
mlRe: Core Data performance advice... creating relationships. I. Savant Jan 15, 17:22
mlRe: Core Data performance advice... creating relationships. I. Savant Jan 15, 17:26
mlRe: Core Data performance advice... creating relationships. mmalc crawford Jan 15, 17:32
mlRe: Core Data performance advice... creating relationships. Phil Jan 15, 21:57
mlre: Core Data performance advice... creating relationships. Ben Trumbull Jan 15, 23:50
mlRe: Core Data performance advice... creating relationships. Martin Linklater Jan 16, 00:49
mlRe: Core Data performance advice... creating relationships. Ben Trumbull Jan 16, 04:27
mlRe: Core Data performance advice... creating relationships. Phil Jan 16, 08:04
mlre: Core Data performance advice... creating relationships. Martin Linklater Jan 17, 18:20