I'm have an issue with circular reference in my DB design. As see the ER diagram below have 2 circular reference that I highlighted with Red and Orange arrow.

enter image description here

Anyone know how to resolve this issue?

  • 1
    What, exactly, needs to be resolved? p.s. welcome to the forum! – Vérace Feb 26 '20 at 7:38
  • Thanks for answering. The issue here is the circular reference. Is there any better way to resolve that? – Jerry Feb 26 '20 at 7:51
  • 1
    If they're required by your data model then use them. It's a bit like NULLs - almost a religious issue, but if they're a necessity, then they're a necessity! Schema design is an iterative process - give it a go and see what the problems are and then perhaps come back to us with a more specific question. Currently, I'm having a hard job envisioning what sort of problems you could be having - much better if you come back with some DDL/DML and say, "guys, I can't do this, that or the other, or performance is bad or... whatever" – Vérace Feb 26 '20 at 8:46

You do not have circular references. All those arrows point in the same direction, "up" to the tenant.

You can insert data to populate the tables without having a dependency on data not yet inserted.

  • Tenant
  • Group
  • Task
  • App
  • Group App
  • User
  • Group User

This would only be a circular reference if, for example, tenant had a user_id reference that pointed back down to the user table, which references back up to the tenant.

The arrows in your diagram have multiple paths back up to the "top" of the hierarchy (tenant, which is drawn to the bottom left). There is a clear tail and head of every path.

But the arrows don't create a circular cycle. In a circular reference, there is no clear head or tail in the path of the arrows.

So great job on your schema design! You did better than you thought.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.