Re: Indexed Attributes in Core Data (was Validating unique objects)
Re: Indexed Attributes in Core Data (was Validating unique objects)
- Subject: Re: Indexed Attributes in Core Data (was Validating unique objects)
- From: Roland King <email@hidden>
- Date: Sat, 13 Feb 2010 12:12:59 +0800
On 13-Feb-2010, at 12:01 PM, Jerry Krinock wrote:
>
> On 2010 Feb 12, at 19:06, Roland King wrote:
>
>> http://cocoawithlove.com/2008/03/testing-core-data-with-very-big.html
>
>> This guy was working on sets of 1 million objects and doing fetches with indexed properties was taking about 2 seconds, vs non-indexed, 600 seconds.
>
> Damn. I never knew that Core Data supported indexes in its sqlite databases. There is no mention of it in the Core Data Programming Guide (searched pdf for 'index'). And I had to read Matt Gallagher's blog post three times before I finally found this teeny tiny tidbit:
>
> "using the checkbox in the XCode Data Model editor"
>
> I opened a model and, sure enough, there it was. I must have seen that hundreds of times and never realized what it was for.
>
> Back to the original topic, malcolm should try this with his uuid.
>
That's right, it's almost not in the documentation anywhere is it, I'd forgotten that. I only started with core data a few weeks ago and messed about with every checkbox I could to see what it did, and I looked for it at the time in the docs and found nothing. There is a mention of an 'isIndexed' property in the NSPropertyDescription class which says that a store can optionally use this information for creating indexes.
I can confirm (from looking at the sqllite database) that core data using sqllite appears to create indexes for relationships and for properties marked 'indexed', with the usual caveat that looking at the tables core data makes is entirely unsupported and could change at any time. I can only assume that the queries it sends for fetches with simple properties are such that the sqllite engine can make use of those indexes.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden