利用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
标签:insert,END,loopname,batch,测试数据,CALL,MySQL,100W,PROCEDURE 来源: https://www.cnblogs.com/gentsir/p/11243236.html