• 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
CoreData - Adding one Index
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CoreData - Adding one Index


  • Subject: CoreData - Adding one Index
  • From: Keith Wilson <email@hidden>
  • Date: Sun, 14 Jan 2007 11:59:11 +1100

Hi,

I have a datamodel that contains an Entity called Event and another called Person

Event has a number of subtypes one of which is called OtherPersonalEvent.

A Person may have 0:M OtherPersonalEvent and OtherPersonalEvent is owned by 1:1 Person.

OtherPersonalEvent has only one property and that is its relationship to Person

When CoreData creates the SQLite tables the subtypes are rolled up into the table for the supertype Event and I can see that PERSON2 is the column that is used fto hold the relationship between OtherPersonalEvent and Person.

I can also see thatno index is created on the column for this relationship. When I access OtherPersonalEvent for Person the response is about 200 milliseconds on a database that contains 50,000 or so Events.

If I remove the Entity called OtherPersonalEvent from my data model and then add an appropriate relationship from Person direct to Event then CoreData does create an appropriate index and access from Person to Event via the new relationship is reduced to about 0.5 milliseconds.

I have previously built a generic database migration function that will convert the data from one version of the datamodel to another and will create a new database based on the new model. BUT the above simple change should not need this heavy handed approach - all I really need to do check the datamodel version and if needed to is to build one physical index, the rest of the data in the database is unchanged.

In a previous post on this list I noticed that _NSCreateIndex can be used to create an index on an attribute. Is there an equivalent private method for creeating an index for a relationship that I could maybe utilise.

Keith


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Prev by Date: Re: NSTextField text changed
  • Next by Date: Doubleclick document...Which app ^instance^ launches?
  • Previous by thread: Re: Querying key bindings?
  • Next by thread: Doubleclick document...Which app ^instance^ launches?
  • Index(es):
    • Date
    • Thread