Hi everyone!
I'm working on coding my own forum and I have no problem with this, I would like to ask those of you knowledgable about the inner workings of php and mysql about which method is faster.
So far I have always been determining post counts, discussions started counts for users using a mysql query, counting all the discussions with the actual user's ID.
However, it might be better/faster to also record this in the user table. I could have a "comment_count" and a "discussion_count" column, when a user adds a comment not only a new comment gets inserted, but the comment_count in the users table is updated using comment_count = comment_count +1. This can be pulled using a session variable, so no php processing would take place at each refresh to get these numbers (which are displayed in the sidebar).
My question is that is this a better way to go? It does mean that I will have somewhat redundant columns, since they could be calculated from other tables.
Thanks a lot,
Daniel