2012-08-01, 10:01 PM
Since it is suggested that suggestions are posted in this forum, so that it can be ignored and just die in oblivion, I thought it'd be harmless to put another one.
The duplicate post check in new thread is very slow as it looks for every post by a user (and ironically enough, can be the cause of duplicate threads)
I would imagine a key on uid,fid,posthash should be enough most of the time (and possibly ipaddress instead of uid if you care about guest posting).
Similar story for newreply, but it's not as big an issue because the search is limited to a thread.
The duplicate post check in new thread is very slow as it looks for every post by a user (and ironically enough, can be the cause of duplicate threads)
if(!$mybb->input['savedraft'] && !$pid)
{
$query = $db->simple_select("posts p", "p.pid", "$user_check AND p.fid='{$forum['fid']}' AND p.subject='".$db->escape_string($mybb->input['subject'])."' AND p.message='".$db->escape_string($mybb->input['message'])."' AND p.posthash='".$db->escape_string($mybb->input['posthash'])."'");
$duplicate_check = $db->fetch_field($query, "pid");
if($duplicate_check)
{
error($lang->error_post_already_submitted);
}
}
I would imagine a key on uid,fid,posthash should be enough most of the time (and possibly ipaddress instead of uid if you care about guest posting).
Similar story for newreply, but it's not as big an issue because the search is limited to a thread.