-- 创建存储过程插入1千万条数据,用时1个多小时 create procedure myproc() begin declare i int; declare num LONG; set i = 1; WHILE i <=10 DO set num=(i-1)*1000000+1; while num <= 1000000*i do insert into table1(id,c_id,collect_day,create_time,update_time) values (num,num,timestamp(subdate(now(),i-1)),now(),now()); set num=num+1; end while; SET i = i+1; END WHILE; end; -- 调用存储过程 CALL myproc(); -- 删除存储过程 drop procedure if exists myproc;
用存储过程造千万条测试数据
猜你喜欢
转载自blog.csdn.net/a1491918446/article/details/87912180
今日推荐
周排行