If there are many comments in one message, and the comments essentially coincide with the messages (for example, they have a headline, pictures and sound, etc.), should I create two tables or only one?
For example, if I use only one table, I may have a parent_id column, so if it is not an answer to something, it will be null, otherwise it will have the identifier of the parent message. On the other hand, I can create a column and a table of comments. Comments may also respond to another comment so that it can get confused quickly.
*Post* id title content image audio parent_id
or,
*Post* *Comments* id id title title content content image author_id audio post_id author_id image audio
The second option is to create indexes. Infact I donβt even need to add author_id or post_id. If I use indexes from the very beginning, will I?
What do you think about this? What would be more effective? I am thinking about using redbeanphp for this.
source share