2014-07-31, 12:58 AM
This is primarily about MyBB 1.6, but probably applies to 1.8 as well.
Also, I'm focusing on the MySQL database, and some things here may not apply to other systems.
These are just some slow queries that I've noticed recently.
A number of MyBB queries use "WHERE LOWER(username) = ...". This causes a full scan over the users table (read: slow query). The default MySQL collation ignores case, so the LOWER() is unnecessary and allows the index to be used.
However, I don't know whether the other supported database systems do this, and it may be possible that some MySQL collations are case sensitive.
I don't know if this wants to be solved or how you'd like to do it, but putting it out there.
Also, the dotfolders query on forumdisplay could use some improvement.
An index on uid,tid on the posts table could help.
I haven't checked, but maybe a GROUP BY tid,uid clause may make it faster, since you don't need _every_ post made by the user.
Also, I'm focusing on the MySQL database, and some things here may not apply to other systems.
These are just some slow queries that I've noticed recently.
A number of MyBB queries use "WHERE LOWER(username) = ...". This causes a full scan over the users table (read: slow query). The default MySQL collation ignores case, so the LOWER() is unnecessary and allows the index to be used.
However, I don't know whether the other supported database systems do this, and it may be possible that some MySQL collations are case sensitive.
I don't know if this wants to be solved or how you'd like to do it, but putting it out there.
Also, the dotfolders query on forumdisplay could use some improvement.
$query = $db->simple_select("posts", "tid,uid", "uid='{$mybb->user['uid']}' AND tid IN ({$tids}) {$visibleonly}");
An index on uid,tid on the posts table could help.
I haven't checked, but maybe a GROUP BY tid,uid clause may make it faster, since you don't need _every_ post made by the user.