Is it always a bad practice to have circular relationships in your database design Is it always a bad practice to have circular relationships in your database design database database

Is it always a bad practice to have circular relationships in your database design


I agree with the comment from @DavidAldridge and I edited the image in the question to help explain what the comment is indicating.

As far as circular references in databases go, my experience is that you can build them and simple queries and updates will work, but once you need more complex joins you end up creating variations of Cartesian joins and quickly consume a lot of memory and the query results might never come back.

And please note that a circular reference is not the same as a self-referencing relationship. Self-referencing tables are a common sight in database design. You can find a simple example here on Self-Referencing Tables or a full tutorial on all Reference Types including Self-Reference.

Database Diagram


If the two "users" had the same value, I would argue that you have violated the "no redundant info" principle. But, the "owner" of the comment is not necessarily the "owner" of the post. So, you are not storing the same user redundantly.

Relations do not have to be in the form of a Tree. If there were some rule that relations had to be only DAGs (Directed Acyclical Graphs), then the question makes sense.

Lets look at the data a different way. You have Entities: Users, Posts, Comments. You have the relationships you mentioned. So, who cares about "circular"?

You could even have "users" "married" to each other. Can't get much more circular than that!

But, then, we should not be doing your homework, especially more than a year late.