这里将告诉您利用MySQL存储过程批量插入100W条测试数据,具体完成步骤:DROP PROCEDURE IF EXISTS insert_batch;
CREATE PROCEDURE insert_batch()
BEGIN
DECLARE n int DEFAULT 1;
loopname:LOOP
INSERT INTO `mlcloud`.`vm_snapshots` (`task_id`, `size`, `time_used`, `create_time`) VALUES ('148', '431644213248', '447', '1556041462');
SET n=n+1;
IF n=1000000 THEN
LEAVE loopname;
END IF;
END LOOP loopname;
END;
CALL insert_batch();
总耗时:
[SQL]
CALL insert_batch();受影响的行: 1时间: 873.795s利用MySQL存储过程批量插入100W条测试数据就为您介绍到这里,感谢您关注懒咪学编程c.lanmit.com.
本文地址:https://c.lanmit.com/shujuku/MySQL/5945.html