Answer the question
In order to leave comments, you need to log in
Should the content of an object be separated from its data by its location in the hierarchy?
It probably sounds not entirely clear, so I will explain:
Let us have a comment tree (Nested Sets or something else, in principle, it doesn’t matter). Is it worth moving fields that are not directly related to comments (lft, rgt, parent_id, etc.) to a separate database table? On the one hand, we get rid of the binding to a specific comment structure (you can always change NS to MP or something else), and on the other hand, there are difficulties with joining these tables.
Answer the question
In order to leave comments, you need to log in
In my opinion the question is wrong. The basis is the tree, not the comments. IMHO, the tree is better to store separately. For the above reason and in the future, you never know what else you want to add, it will be easier to do this with a pure tree than with something incomprehensible. And there shouldn't be any difficulties with joins...
Only for comments (or other objects of the same type combined into a hierarchy), IMHO, it’s not worth it, it will only unreasonably increase the complexity - when you need to change the structure, then you will change it, it may not be needed at all, or it may be necessary to make several hierarchies at the same time.
Another thing is if heterogeneous objects are combined into a hierarchy, or one object can be included in different hierarchies - here it is unambiguous (if there is no question of denormalization in order to increase performance) objects separately, hierarchies separately, it may also make sense to take out metadata. In general, for hierarchies it makes sense, IMHO, to look towards NoSQL.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question