Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7944221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:29:23+00:00 2026-06-04T00:29:23+00:00

At the moment, I have two Core Data models, Model A and Model B.

  • 0

At the moment, I have two Core Data models, Model A and Model B.

Model A needs a value from Model B. (Model A -> Entity1 -> valueFromModelB)

At the moment, I’m executing a fetch request and filtering in Model A’s subclass of NSObject. However, this doesn’t seem very efficient because I need to update this value quite often.

What would be the best way to accomplish this? Would it be better to merge the entities from Model A and Model B and create a relationship between the two? Ideally I’d like to keep these separate, but if merging is easier and more efficient, then I may go that route.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:29:25+00:00Added an answer on June 4, 2026 at 12:29 am

    From your question, was not sure if you have already looked at the option of prefetching to save some over-head. According to Core Data Documentation, here is a code snippet for prefetching.

    NSManagedObjectContext *context = /* get the context */;
    NSEntityDescription *employeeEntity = [NSEntityDescription
    entityForName:@"Employee" inManagedObjectContext:context];
    NSFetchRequest *request = [[NSFetchRequest alloc] init];
    [request setEntity:employeeEntity];
    [request setRelationshipKeyPathsForPrefetching:
    [NSArray arrayWithObject:@"department"]];
    

    The code fetches employee and department information, but what I was not sure was if Department is in a different data model, can it be put to use using something like a NSPersistentStoreCoordinator.

    One other note from Apple’s Core Data preformance recommendation is

    Each round trip to the persistent store (each fetch) incurs an overhead, both in accessing the store and in merging the returned objects into the persistence stack. You should avoid executing multiple requests if you can instead combine them into a single request that will return all the objects you require. You can also minimize the number of objects you have in memory.

    So if ideally if you can merge two different Core Data models, that is going to save memory and round-trips to fetch data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two questions. 1: At the moment I have two model classes that
I have a core data model with an entity called clients that is made
I have two fields representing data range (from and to). I need to check
At the moment I have two tables, products and options . Products contains id
I have two nested loop in XSL like this, at this moment I use
So, I have two types at the moment: const unsigned char* unencrypted_data_char; string unencrypted_data;
I am making two sites at the moment and have come up to a
At the moment I have a combobox that is populated from the name fields
I have a problem with Core Data which has left me at the end
At the moment I have two (maybe more) unordered lists which are sortable with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.