[英]LAMP/MySQL - run time delay during SQL batch insert
我有一個 SQL 批量插入語句,它通過解釋正確索引和驗證。 我正在使用批量插入創建 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);
任何幫助將不勝感激。
感謝有關 innodb_lock_wait_timeout 的評論,我發現必須為 MySql 分配更多內存。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.