New to Craft, and unsure how it works under the hood. In terms of overall performance, I'm curious to know which of the following scenarios is the most performant approach in terms of DB queries and server strain.
SETUP: I'm building a sort of blog/forum hybrid with user-generated posts. But in this case, comments are not an afterthought tacked onto the main post (like most blogs). Instead, comments are a central part of the overall content. Sort of like StackExchange or Reddit.
SCALABILITY: Let's prepare for a site that grows to a million+ Posts... and millions more Comments.
IDEA 1: Build a traditional BlogPost/Comment system where each new Post requires users to upload a single image and a rich-text description. Then Comments are tacked on as usual.
IDEA 2: Build each BlogPost with a Matrix Row featuring only 2 fields [ image | rich-text ], and instead of tacking on traditional comments, simply append additional rows to the post's Matrix Field via front-end editor form.
While Idea 1 is well-tested and proven, I think Idea 2 might save a lot of computational power on page delivery.
If I understand correctly, Idea 1 must make at least 2 (and probably several) loops through the database, first the Blog and then the Comments...
But Idea 2 needs only one loop through the Post/Matrix to grab everything. And then even little things would become easier, (e.g. Comment count = how many rows in the Matrix. AND Image count = how many images in the entire Matrix field. AND most recently updated post = most recent Post/Matrix update, not most recent Comment).... all without doing additional queries on a Comments table.
QUESTION 1: Is my understanding flawed, or does Idea 2 make more sense in terms of fewer queries and server load?
QUESTION 2: With Craft, is it possible for a Matrix field to be appended row by row from a front-end form?