• 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
Pre-fetching ERTags
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pre-fetching ERTags


  • Subject: Pre-fetching ERTags
  • From: Paul Hoadley <email@hidden>
  • Date: Tue, 10 Sep 2013 20:03:35 +0930

Hello,

I have a WODisplayGroup displayGroup containing a collection of EOs.  The entity is registered as a taggable entity, and its tag entity is "TemplateTag", a subclass of ERTag.  I want to find the set of all TemplateTags that are currently applied to any object in displayGroup.allObjects()—that is, if I called tags() on each object in allObjects(), what would be the union of all the results (a subset of _all_ TemplateTags)?  And that's literally how I'm finding them at the moment: by looping over each EO, calling tags(), and adding the result to an NSMutableSet.

This approach seems slow, and, indeed, is resulting in a lot of hits to the database.  I've tried calling setPrefetchingRelationshipKeyPaths() on the WODisplayGroup's EOFetchSpecification in a couple of ways:

* using the keyPath "tags"—this lead ERProfiling.framework to claim a reduction in SQL statements to an acceptable level, but this wasn't reflected in logging out the actual SQL.
* attempting to unroll that flattened relationship by using the internal names created for the intermediate relationships—this didn't seem to work at all.

I also tried ERXBatchFetchUtilities.batchFetch() on displayGroup.allObjects() using both of those key paths.  The first made no difference (to the SQL output) and the second failed with an exception.  (In all cases, the majority of the SQL statements were SELECTs from the join table.)

I have two questions:

1.  Should I expect to be able to pre-fetch/batch-fetch ERTags like this at all?

2.  If not, or in any case, can anyone suggest a better method to solve the original problem?  (That is, how do I find the subset of all tags being those currently applied to a set of taggable EOs?)


-- 
Paul Hoadley
http://logicsquad.net/



 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: ERAttachment and custom filesystemPath
  • Next by Date: Re: ERAttachment and custom filesystemPath
  • Previous by thread: Re: ERAttachment and custom filesystemPath
  • Next by thread: Status Update - Learning The Wonders Book
  • Index(es):
    • Date
    • Thread