当前位置: 移动技术网 > IT编程>数据库>Mysql > 利用MySQL存储过程批量插入100W条测试数据

利用MySQL存储过程批量插入100W条测试数据

2019年07月26日  | 移动技术网IT编程  | 我要评论
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

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网