Only you can say which is the best way for your case.
The first form can be very interesting and many people think it is not. Ask a few questions:
You need to access the comment in isolation or it will always be accessed through the post? If it is an aggregated direct association and does not have a proper identity to normalization not usually necessary. Who works with Nosql, who should actually be called Norel, does this a lot and find it great (in many cases it is), what many do not realize is that the relational model of Rdbmses is optional.
Will you normally read all the comments together? If the previous answer is yes and here too it is yes, then there is a good chance it is the best option. If you’re going to read everything together why would you need to separate?
2000 comments on a post? If you have this you have something humanly unanswerable, if you have dozens of comments there must be something wrong. Even on Facebook, you don’t get that, and when you do, it’s the same thing that you don’t have any comments on, no one will read it. This site was born from the observance that other sites could not manage these things and end up not serving the purpose.
2000 comments all in the system? That doesn’t make "tickle".
Probably I would make the second option, just create some standard to reduce the cost of space:
You can create a character that indicates the break of what the user is and what the comment is. Actually you cannot use the ;
unless you escape that character in the text before saving, and you have to deal with that. The separation of the user doesn’t matter so much, it could be the comma because it only has numbers, right? Needless to say that a comment comes next, after the comma after the user’s number is always a comment that will end where it has this terminating character. If you do it the way you’re thinking and someone comments ";user" will mess up your data, there will be a text Injection.
65,teste;66,teste com \; escapado;
You can use a number, maybe in binary form (4 bytes should be enough), at first indicating the size of that entire input, so you don’t need a terminator character. It will take up a little more space, but is simpler and safer. It could make the user number in binary form as well. If you use the binary form you have to be careful if you use it on different platforms. If you use text as a fixed size, it will take up more space, or have a separator, especially if the text of the comment starts with a number.
000♣000♣teste000¶000♠teste com ; escapado
You’re accidentally using it "Nosql" the right way, productive and where it is useful.
Did the answer solve your question? Do you think you can accept it? See [tour] if you don’t know how you do it. This would help a lot to indicate that the solution was useful to you. You can also vote on any question or answer you find useful on the entire site
– Maniero