Mysql循环插入百万条数据

测试mysql大数据量下的查询速度,想循环插入10W条或者更多记录到数据库中,发现可以用存储过程插入,记录一下

DROP PROCEDURE if exists insertdata;
delimiter //
CREATE PROCEDURE insertdata() 
begin 
declare num int; 
set num=1; 
while num < 1000000 do 
insert into tabless (id,title, tel) values(num,concat("title", num),concat("134", num)); 
set num=num+1;
end while;
end//
delimiter;
call insertdata();

说明: 定界符为"//"    declare  声明字段类型    call 调用存储过程

posted @ 2015-07-02 13:42  SunsCheung  阅读(573)  评论(0编辑  收藏  举报