I noticed my forum listing pages were taking a while to load. After checking it with the devel module, the problem seems to be with the forum statistics, which are taking between 1 and 3 seconds to load. Is there any way to speed this up?

Executed 87 queries in 2547.8 milliseconds:
2091.28ms - advanced_forum_statistics_latest_user
273.77ms - advanced_forum_statistics_users
...

Comments

michelle’s picture

Title: advanced_forum_statistics_latest_user query is slow » Speed up statistics queries
Version: 6.x-1.1 » 6.x-2.x-dev
Category: bug » task

My first response to this was, "If I knew how to make it faster, don't you think I would have?". Luckily, I decided to be grumpy on IRC rather than in the issue queue, and ended up being pleasantly surprised when a couple of the folks there stepped up to help out my weak SQL skills. I'm not up for working on this today as I'm already trying to do a major site upgrade while fighting a nasty bug, possibly of the pig variety, so I'm going to make note of what they said and come back to this.

From dereine:
return db_fetch_object(db_query_range('SELECT uid, name FROM {users} WHERE status = 1 AND access > 0 ORDER BY created DESC', 0, 1));

From killes:
* function advanced_forum_statistics_online_users() { <== if you only want the authenticated users you can omit the join on the session table
* you can use users.access instead

Michelle

michelle’s picture

Marked #939778: Very slow sql request duplicate.

Michelle

michelle’s picture

If anyone is looking to help with AF, this would be a good one to pick up. It's been a bit over a year and I'm not sure what my notes mean anymore. LOL! I'll probably figure it out when I look at the code but I'd love to have a patch waiting here for me when I get that far. :)

Michelle