I am starting the somewhat tedious process of analysing the queries again and have one or two proposals.
While this may flout some of the rules of database normalisation, sometimes a database designer has to be pragmatic and to balance performance and query count against elegance and dogma. This is what I am looking into.
We could get a not insignificant improvement in both the number of queries being run and the processing time if we:
- Stored in the sfforum table (a) the total number of posts (in all topics) in that forum; (b) The name of the last person to make a post in any of the topics within the forum and (c) the date of that last post. We already store the topic count within a forum so this sort of pragmatic approach would not be new!
- Likewise – we currently store in sftopics the post started date, the user id of who started it, the post count and how many times it has been viewed. Changing the user id of who started the topic to the user name and adding (a) the user name of the last post and (b) the date of the last post would also see an improvement.
There will be others along later!
Comments?