Solution 1
Gcanhete, the ideal is to revise your database modeling, there should be a clean way to store the data in the database, preferably obeying the first 3 formal rules.
I understand that the way you want to do now you are wanting to store a bank line for each group and comment, but this is not sustainable, for example, what size field you will use to accommodate this data, the what will you do when there are more comments than you expect?
The ideal is to store so that each comment has its own record, with all relevant information.
If the problem is performance ai is the case of adjusting in other points (indices, cache, etc).
If you still want to store the array inside the database you still have options:
- Store fully (pass array to string and store it)
- In this case you still have the benefits of being able to fetch and change and can be direct in SQL as in other languages (for APIs for example).
- Store serial (pass through serialization)
- You lose some of the ability to edit and read, since any error can invalidate the information.
- Encode with Base64 or other reversible algorithms.
Solution 2
Another option if you want to store a non-rigid data structure (such as a relational database) is to use NoSQL banks such as Redis and MongoDB, where you can pass your entire arrays to persistence.
In this second case you can store them and retrieve them practically ready for use.