• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: coredata and loooooooooooooooong waits
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: coredata and loooooooooooooooong waits


  • Subject: Re: coredata and loooooooooooooooong waits
  • From: Benjamin Salanki <email@hidden>
  • Date: Tue, 17 Oct 2006 11:18:11 +0200

I am in fact using an SQL store, and I originally used this code:

	NSManagedObjectContext * moc = [[NSApp delegate] managedObjectContext];
	NSEntityDescription * entityDescription = [NSEntityDescription entityForName:@"SCEntity" inManagedObjectContext:moc];
	NSFetchRequest * request = [[[NSFetchRequest alloc] init] autorelease];
	[request setEntity:entityDescription];
	NSPredicate *predicate = [NSPredicate predicateWithFormat:@"storeID.storeID = %d", [[store valueForKeyPath:@"storeID"] intValue]];
	[request setPredicate:predicate];
	NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"clipID" ascending:NO];
	[request setSortDescriptors:[NSArray arrayWithObject:sortDescriptor]];
	[sortDescriptor release];

	NSArray* result = [moc executeFetchRequest:request error:nil];

and this is where I first got the responses that it was taking too long. After this I changed to the approach of going from the store side of things rather than the item side.

Ben


On Tuesday, October 17, 2006, at 11:10AM, Jakob Olesen <email@hidden> wrote:

>
>On 17/10/2006, at 10.54, Benjamin Salanki wrote:
>
>> But if I do it this way it will read through all the clips, which
>> can be in the thousands, rather than all the stores, where there's
>> only 5 max. Or am I not getting this right?
>
>In theory, yes, but Core Data creates indices for all the
>relationships, so SQLite is able to use an index for that query.
>It is pretty much the same query Core Data is using internally when
>you say [store valueForKey:@"storeClips"]
>
>Alternatively, you can do a batch fault with a predicate "SELF in %
>@", [store valueForKey:@"storeClips"]
>
>This is only true for the SQLite store. The XML store will be slow,
>it has no indices.
>
>
>
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >coredata and loooooooooooooooong waits (From: Benjamin Salanki <email@hidden>)
 >Re: coredata and loooooooooooooooong waits (From: Jakob Olesen <email@hidden>)

  • Prev by Date: Re: coredata and loooooooooooooooong waits
  • Next by Date: Re: multi-threading, AppKit etc
  • Previous by thread: Re: coredata and loooooooooooooooong waits
  • Next by thread: keypress events + responder chain
  • Index(es):
    • Date
    • Thread