What about using bind variables?
Bah, looks like it would mean restricting Beehive to PHP5+MySQL 4.1 (or later),
but it should give a significant boost to query performance; maybe it could be added as a branch/mod?
Also (this may already be done, but I couldn't see anything on a quick glance), what about having shortcut thingies - um, by which I mean something similar to this:
Pseudo-PHP code:
if (looking_for_unread_messages && $_SERVER['LAST_BH_MESSAGE'] > $_SESSION['USER_LAST_THREADLIST'])
{
// perform query as normal
}
else
{
// do cut-down query or cached query or whatever
}
ie: Store a server-wide variable of the last message post time, and use it to determine if there's any point even running a [complete] query.