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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:54:59+00:00 2026-05-12T06:54:59+00:00

In a general one-to-many (parent-to-child) relationship, is there a significant efficiency difference between (a)

  • 0

In a general one-to-many (parent-to-child) relationship, is there a significant efficiency difference between (a) putting parent_id in the child table and (b) using a pivot table of only parent_id, child_id?

NOTE: Assume Oracle if necessary, otherwise answer using a general RDBMS.

  • 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-12T06:54:59+00:00Added an answer on May 12, 2026 at 6:54 am

    If by PIVOT table you mean a many-to-many link table, then no, it will only hamper performance.

    You should keep parent_id in the child table.

    The many-to-many link table takes an extra JOIN and therefore is less efficient.

    Compare the following queries:

    SELECT  *
    FROM    child_table c
    JOIN    child_to_parent cp
    ON      cp.child = c.id
    JOIN    parent p
    ON      p.id = cp.parent
    WHERE   c.property = 'some_property'
    

    and this one:

    SELECT  *
    FROM    child_table c
    JOIN    parent p
    ON      p.id = c.parent
    WHERE   c.property = 'some_property'
    

    The latter one is one JOIN shorter and more efficient.

    The only possible exception to that rule is that you run these queries often:

    SELECT  *
    FROM    child_table c
    JOIN    parent_table p
    ON      p.id = c.parent
    WHERE   c.id IN (id1, id2, ...)
    

    , i. e. you know the id‘s of the child rows beforehand.

    This may be useful if you use natural keys for your child_table.

    In this case yes, the child_to_parent link table will be more efficient, since you can just replace it with the following query:

    SELECT  *
    FROM    child_to_parent cp
    JOIN    parent_table p
    ON      p.id = cp.parent
    WHERE   cp.child IN (id1, id2, ...)
    

    and child_to_parent will be always less or equal in size to child_table, and hence more efficient.

    However, in Oracle you can achieve just the same result creating a composite index on child_table (id, parent_id).

    Since Oracle does not index NULL‘s, this index will be just like your child_to_parent table, but without the table itself and implied maintenance overhead.

    In other systems (which index NULL‘s), the index may be less efficient than a dedicated table, especially if you have lots of NULL parents.

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

Sidebar

Ask A Question

Stats

  • Questions 257k
  • Answers 257k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Firstly there isn't a helper method for copying a file… May 13, 2026 at 10:44 am
  • Editorial Team
    Editorial Team added an answer Delay the opening - How do I open one Fancybox… May 13, 2026 at 10:44 am
  • Editorial Team
    Editorial Team added an answer You can use the find method in a loop to… May 13, 2026 at 10:44 am

Related Questions

I have two tables in a one to many relationship. (products and qty break
ORIGINAL (see UPDATED QUESTION below) I am designing a new laboratory database that tests
In the current examples on ASP.NET MVC I see quite basic entities, with simple
I'm looking for possible ways to persist the following classes. Subsonic SimpleRepository looks like

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.