4 ms·
You don't have to reflect the threaded nature of the discussion in your database. Just give every comment a foreign key to the original post or forum topic, and
by lacker 18y ago
You don't have to reflect the threaded nature of the discussion in your database. Just give every comment a foreign key to the original post or forum topic, and whenever you're displaying anything about that original post, fetch all comments about it from the database, and then after the DB part is done, then worry about which comments you actually want to display. A single DB call to fetch at most a few thousand comments should be faster than a DB call for each comment.