Add Index on comments.(type,status) and comments.parent_id to Accelerate Query
Created by: wtune
Problem
Missing index on table comments column parent_id and (type, status) might make the underlying query slow. From BaseCommentRepositoryand other related file, we can find that we always read comments by type(DiscriminatorColumn, 0->postcomment 1->sheetcomment and 2->journalcomment)、status、post_id and parent_id.Adding index on these columns can improve the query efficiency significantly, so the performance impact for write operations is acceptable under common cases.
Possible Solution
Add Index on comments.(type,status) and comments.parent_id