Quote: |
/* This is an optimization intended for topics with many messages */ if ($frm->replies > 250) { q("CREATE TEMPORARY TABLE {SQL_TABLE_PREFIX}_mtmp_".__request_timestamp__." AS SELECT id FROM {SQL_TABLE_PREFIX}msg WHERE thread_id=".$_GET['th']." AND apr=1 ORDER BY id ASC LIMIT " . qry_limit($count, $_GET['start'])); } $result = $query_type('SELECT m.*, t.thread_opt, t.root_msg_id, t.last_post_id, t.forum_id, f.message_threshold, u.id AS user_id, u.alias AS login, u.avatar_loc, u.email, u.posted_msg_count, u.join_date, u.location, u.sig, u.custom_status, u.icq, u.jabber, u.affero, u.aim, u.msnm, u.yahoo, u.users_opt, u.last_visit AS time_sec, l.name AS level_name, l.level_opt, l.img AS level_img, p.max_votes, p.expiry_date, p.creation_date, p.name AS poll_name, p.total_votes, '.(_uid ? ' pot.id AS cant_vote ' : ' 1 AS cant_vote ').' FROM '.($frm->replies > 250 ? '{SQL_TABLE_PREFIX}_mtmp_'.__request_timestamp__.' mt INNER JOIN {SQL_TABLE_PREFIX}msg m ON m.id=mt.id' : ' {SQL_TABLE_PREFIX}msg m').' INNER JOIN {SQL_TABLE_PREFIX}thread t ON m.thread_id=t.id INNER JOIN {SQL_TABLE_PREFIX}forum f ON t.forum_id=f.id LEFT JOIN {SQL_TABLE_PREFIX}users u ON m.poster_id=u.id LEFT JOIN {SQL_TABLE_PREFIX}level l ON u.level_id=l.id LEFT JOIN {SQL_TABLE_PREFIX}poll p ON m.poll_id=p.id'. (_uid ? ' LEFT JOIN {SQL_TABLE_PREFIX}poll_opt_track pot ON pot.poll_id=p.id AND pot.user_id='._uid : ' '). ($frm->replies > 250 ? ' ORDER BY m.id ASC' : " WHERE m.thread_id=".$_GET['th']." AND m.apr=1 ORDER BY m.id ASC LIMIT " . qry_limit($count, $_GET['start']))); |
It was a very simple code fix/change to the SQL Query in the msg.php.t source file.
As far as offering this as a user preference or setting, that's probably beyond my coding abilities at this point. I wouldn't even know where to start!