In the first case, comment on nested replies. In this case, how is the database designed? I have two ideas: one is to save the reply comment id. If this is not the case, every nested comment must iterate all the parent classes, and the performance is poor. The second idea is to save the IDs of all parent classes, using...First case
Comment nested reply. In this case, how is the database designed?
I have two ideas: one is to save the reply comment id. If this is not the case, every nested comment must iterate all the parent classes, and the performance is poor. The second approach is to save the IDs of all parent classes, which are separated by a comma (,) or a broken number, and exist in a field.
Case 2
How is the database designed for Weibo forwarding?
I also have two ideas: one is the id of the person who saves the forwarding, the other is the id of the person who previously forwarded the microblog, and the other is all the content that stores the forwarding. Which one is more suitable?
There are no more appropriate ideas .? Please kindly advise.
Reply content:First case
Comment nested reply. In this case, how is the database designed?
I have two ideas: one is to save the reply comment id. If this is not the case, every nested comment must iterate all the parent classes, and the performance is poor. The second approach is to save the IDs of all parent classes, which are separated by a comma (,) or a broken number, and exist in a field.
Case 2
How is the database designed for Weibo forwarding?
I also have two ideas: one is the id of the person who saves the forwarding, the other is the id of the person who previously forwarded the microblog, and the other is all the content that stores the forwarding. Which one is more suitable?
There are no more appropriate ideas .? Please kindly advise.
Comment on Building
First of all, this form is rare, and features are simplified. It is not applicable to the trend of mobile products.
In terms of implementation, we used to record the Comment number that he replied to in each piece of data. After reading your questions, I personally feel that your second implementation adopts redundant storage and records the comment numbers of all superiors. This is a good note and provides better performance. When storing multiple values, you used to separate them with commas. Now you prefer to store them with json_encode. Use and Storage are more flexible.
Weibo-based forwarding
My personal idea is that there is a relational table, and each time it is forwarded as a relational data, because there is no architecture issue in the forwarding.
Refer to the data structure design of the Forum.