利用MySQL存储过程批量插入100W条测试数据
程序员文章站
2022-06-23 14:53:25
总耗时: [SQL] CALL insert_batch();受影响的行: 1时间: 873.795s ......
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