LAMP / MySQL-SQL批处理插入期间的运行时间延迟

问题描述

我有一条SQL批处理插入语句,该语句已正确插入索引并通过explain进行了验证。我正在使用批处理插入创建73行。作为批处理插入的一部分,我在每个插入的记录上使用NOW()记录日期/时间戳。

在插入过程中,插入68条记录后,创建其余5条记录会有50秒的延迟。

在插入过程中可能导致延迟的原因是什么?我应该检查哪些日志?

$values = "";
foreach ($recipients as $recipient) {
    $values = $values . "(" .
              $msg['msg_id'] . "," .
              $recipient['mbr_id'] . "," .
              "NOW()" . "),";
}

// remove the last comma from the value list to terminate the values list
$values = rtrim($values,",");

$sql = "INSERT INTO message (message_id,member_id,create_dtm)
        VALUES " . $values;

// internal library function using PDO to write to the database 
$pdb->db_commit($sql);  

任何帮助将不胜感激。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)