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

  • Home
  • SEARCH
  • 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 6020669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:36:08+00:00 2026-05-23T03:36:08+00:00

I have some flexibility here so I’m looking for some advice before I lock

  • 0

I have some flexibility here so I’m looking for some advice before I lock things down. I also have a couple ways of solving this problem but I’m looking for advise on the most efficient way of doing this. Since the specifics of my data types are a bit obscure I’ll use a more understandable object metaphor.

Right now I have two main tables, and a large but finite number of additional tables. The following business logic applies.

  1. Each specific animal table has a unique filed assigned to it, something like “snout diameter” for a pig, or “whiskers” for a cat. There is also another field
  2. The animal table has a field marking the animals “Role”.
  3. There can be multiple animals in a cage.
  4. Animals are linked to Cages by FK constraints. The specific Animal tables are linked to the animal table by FK constraints.

    • Cages
      • Animal
        • Cat
        • dog
        • Pig, etc

The main question being asked is, what’s in a cage? I also need be able to search through all the cages as quickly as possible and get all the info for animals that fall into the role “tasty”. Sometimes a pig will be “tasty”, other times it could be a cat. Depending on the type of animal that’s “tasty” I need to display it’s specific info.

What’s the most efficient schema design, or SQL statement to find this info?

My first attempt at this had Only Cages and then a bunch of “SpecificAnimal” tables. This seemed like a bad idea because I would have to do a join across 10+ tables to figure out what was in a cage.
I then moved common attributes to the Animal Table, this allowed me to easily see what animals were in a cage, although this still required searching across the specific tables to get all the data.
I contemplated storing the specific attributes into some form of CSV string (but I’m not that desperate yet)
Of course I could go EAV, but that also seems inefficient since there really are a finite number of animals.

Am I being to worried? Should I just bite the bullet and accept Joins across 10 tables? Just worried about performance…. Any ideas, or design patterns that can be recommended. Suffering from information overload and a head cold. Help please.

  • 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-23T03:36:09+00:00Added an answer on May 23, 2026 at 3:36 am

    It’s really hard to answer ‘what is the best schema’ questions, because they always involve tradeoffs. Part of that means that to accurately trade off one design against another, you have to have measurements (of speed, for example) to base your decision on. (This is probably not the answer you were looking for).

    For what it’s worth, 10 joins is not a massive number, and depending on the number of animals and cages in your system you might never notice a speed issue. Further, if there really is one ‘main query’, then you can use materialised views to make at least that query fast to answer.

    Finally, some overarching advice: go for a clean data model until you have hard numbers to dictate that you ‘muddy’ the design.

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

Sidebar

Related Questions

I need some advice. (For those who have already read this before I have
I love the flexibility of named branches but I have some concerns about the
I have some UI in VB 2005 that looks great in XP Style, but
I have some ASP.NET web services which all share a common helper class they
I have some code for starting a thread on the .NET CF 2.0: ThreadStart
We have some input data that sometimes appears with &nbsp characters on the end.
I have some classes layed out like this class A { public virtual void
I have some C# / asp.net code I inherited which has a textbox which
I have some code like this in a winforms app I was writing to
I have some kind of test data and want to create a unit test

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.