I have a forum with a lot of topics (written in Angular+Laravel+Xampp), and I wondered how I should display the last comment when the user don't open specific topic, only seeing the headers/titles.
My structure is: There are sections (categories), and a section can have many topics, and a topic can have many posts, and a post can have many comments.
When a user views all the sections (the biggest categories), I wanna display for each of them the last messages in those topics'.
I could just search for every post and see which one of them has the latest comment, but then I should search through all the comments which seems a little redundant.
Maybe I should make a column e.g. "last_comment" for the sections table, and update it every time a post get a comment?
What is the best approach?