I'm running a Joomla based Swedish community site for dancers,
www.dansmaffian.se, which is growing quite quickly. We're currently about 250 concurrent users at the evenings.
I'm staring to run out of resources on my servers and the major bottleneck currently is the jb_last_subjects module which I've modified for my needs. I'm currently running on an old system based on Joomla 1.0.12 and JoomlaBoard 1.1.3 but am about to upgrade to the latest version of Fireboard, but like to discuss whether any improvments have been made regarding my specific problem.
The problem is that on the frontpage of the site I want to show a list of the 30 latest forumposts together with number showing how many replies each thread contains. However the jb (JoomlaBoard) message table doesn't seem to keep any record in the first post about how many replies it has gotten, so to find out how many replies each thread contains the whole datebase has to be searched for messages with the same subject, which is a real performance killer.
To make things even worse it didn't seem to be enough to do a GROUP BY on subject and ORDER BY time DESC, as the GROUPING is done before the reordering so timestamp returned by the group of records with the same subject is not the one with the latest timestamp, so the ordering of which thread has been commented lastly gets incorrect.
The only solution I found to that was to use a subquery returning ALL records in ORDER BY time DESC as an inner SQL query to the main SQL GROUP QUERY.
So basically my query looks like this, a little simplified though:
SELECT sb.subject, count(sb.id) as replies FROM
(SELECT * from #__sb_messages ORDER BY time DESC) AS sb)
GROUP BY sb.subject
ORDER BY sb.time DESC LIMIT 30
So, my question is, has the database structure been improved in newer versions of FireBoard so this can be done in a more effient way? Ideally I'de like the message table to contain two new columns, "replies" and "last_reply_date", where last_reply_date should contain the original post timestamp if no replies have been made.
This would allow the table to very efficiently indexed and searched for last posts. The only caveeat as I can see is that the delete post must also be made a little more intellegent, decreasing the replies-counter on the threadstarting post.