RE: Core Data Fetching Limitations?
RE: Core Data Fetching Limitations?
- Subject: RE: Core Data Fetching Limitations?
- From: Ulai Beekam <email@hidden>
- Date: Tue, 23 Jun 2009 00:04:29 +0000
- Importance: Normal
Thanks for your reply. This is a good idea.
But in the end, won't my predicate have something like "SELF IN thatSetWeDeterminedUsingYourMethod"?
As I said originally, I will need to combine a bunch of such predicates together to form an aggregate predicate. Much in a way that smart playlists add a bunch of predicates together. (For example: I may want to combine that 'Jo' and 'Volvo' predicate with another 'Dan' and 'Benz' predicate.) This raises the question of SQLite storage's limitation that any given query cannot contain more than one occurrences of IN (same for ANY and ALL). You have any thoughts on this matter?
I guess another question to you could be: Have you compared Core Data's performance using SQLite vs. Binary? Both are said to be "fast" in the Core Data doc. However, rumors claim SQLite wins. On the other hand, Binary will allow me to combine "IN"s.
----------------------------------------
> From: email@hidden
> To: email@hidden
> Subject: Re: Core Data Fetching Limitations?
> Date: Mon, 22 Jun 2009 12:53:54 +0100
>
> I guess the trickiest part of your scenario is that the predicate is
> being applied across 2 relationships, making the process quite
> intensive. What I'm pretty certain you can do (and in fact in this
> scenario is probably more efficient) is to fetch "all employees whose
> name starts with 'Jo' and whose assigned car has the name of 'Volvo'."
> Then, query that the result of that fetch for each employee's
> department, plonk them into a set, and you will have a unique set of
> departments matching the query.
>
> On 22 Jun 2009, at 02:00, Ulai Beekam wrote:
>
>>
>> (Sorry, the previous post was not sent with plaintext)
>>
>> Please draw up the following model on a piece of paper:
>>
>> We have three entities: Department, Employee, and EmployeeCar. Each
>> of them has the 'name' attribute.
>>
>> Department has the to-many 'employees' relationship to Employee. Its
>> inverse is, naturally, the to-one 'department' relationship in
>> Employee.
>>
>> Employee has a to-one 'employeeCar' relationship to EmployeeCar. Its
>> inverse is the to-many 'employees' relationship in EmployeeCar.
>> This reflects the reality that a single car can be assigned to more
>> than one employee, but a given employee does only have one car
>> assigned to him.
>>
>>
>> NOW HERE IS THE QUESTION: How can I make Core Data: **** fetch all
>> departments that have an employee whose name starts with 'Jo' and
>> whose assigned car has the name of 'Volvo' ****
>>
>>
>>
>> Can Core Data even make such fetches? Can it be done without
>> ALL,ANY? I ask because I might want to combine many such conditions,
>> making it impossible to do with the SQLite storage option. Maybe I
>> can just simply forget the SQLite storage for this? What are the
>> alternatives? Am I doomed to work with the other slower storages?
>>
>> And note that I do indeed have to have it inside a single predicate
>> because I have an NSArrayController of Department objects, and after
>> having made the correct predicate (for which I need your help) I
>> plan to set the array controller's fetch predicate to that predicate.
>>
>> Thanks, U.
_________________________________________________________________
Windows Liveā¢: Keep your life in sync. Check it out!
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009_______________________________________________
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