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 983783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:54:45+00:00 2026-05-16T04:54:45+00:00

I have a database design that’s normalized well enough, but now I need to

  • 0

I have a database design that’s normalized well enough, but now I need to add a new table (entity, since I’m actually using Core Data) and I’m running into some issues.

Landscape has many Assessment
Assessment has one AssessmentType
AssessmentTree has one Assessment
AssessmentTree has one each of 12 other entities, omitted for space.

Now, I’m adding a Photo entity, which can be associated with ANY of the above entities. I need to have some sort of relationship in place such that I can grab only the Photos related to an AssessmentTree, for example, or perhaps an Assessment, which would be a superset of the Photos related to an AssessmentTree.

(I feel I may not have done a great job explaining the situation so let me know if I can clarify in some way.)

Possible solutions I’ve considered, none of which are satisfying:

  1. Create references to every other object from within the Photo entity. Nil references would then mean the Photo was not a part of that set.
  2. Create a new entity, PhotoRelations, that would hold a reference to the Photo and a reference to one of the objects it’s attached. The problem is that while I could easily do this with an SQL system, I can’t think of how to translate it into CoreData.

Any help would be appreciated!

  • 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-05-16T04:54:46+00:00Added an answer on May 16, 2026 at 4:54 am

    The way that Core Data is designed to handle this problem is through entity inheritance.

    In theory, you would handle this just the way you would with non-Core Data objects defined with subclasses. You would define an abstract parent entity that links to a concrete photo entity. Then you would have all the entities that need a photo inherit from that parent entity.

    However, owing to an implementation detail with SQL stores, all the child entities of a parent entity in any graph end up in the same SQL table on disk. This can degrade fetch performance because all the instance of all sub-entities stored in a table have to be searched even if your just fetching one entity.

    It’s a pain. I keep hoping they will refractor that limitation out.

    You could test the entity inheritance with test data and see if it is a problem or not for your particular implementation. If you have only a few thousand sub entities that fetch on simple attributes (strings, numbers, dates etc), then you may be able to use entity inheritance without any significant performance hit.

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

Sidebar

Related Questions

What do I have to consider in database design for a new application which
I'm fairly new to database design, but I understand the fundamentals. I'm creating a
Does someone have any tips/advice on database design for a web application? The kind
I have database with many tables. In the first table, I have a field
I have a database that contains a date and we are using the MaskedEditExtender
I have a database table and one of the fields (not the primary key)
I have a database file that is generated on a PC using Sqlite. This
I'm about to start a Database Design that will simply manage users under companies.
I have a database that has different grades per course (i.e. three homeworks for
I have a question regarding this database design. I am a bit unsure of

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.