mysql循环批量插入测试数据

http://blog.51cto.com/tianxingzhe/1676097

 

 

DROP PROCEDURE test_insert ;

DELIMITER $$

CREATE PROCEDURE test_insert()

BEGIN
DECLARE i INT DEFAULT 0;
START TRANSACTION;
WHILE i<10000000
DO
insert into big_table( field01, field02, field03) SELECT FLOOR(RAND() * 10000),FLOOR(RAND() * 10000),MD5(RAND() * 1000);
SET i=i+1;
END WHILE;
COMMIT;
END $$

DELIMITER ;


call test_insert();

posted @ 2018-03-21 10:35  穆穆兔兔  阅读(199)  评论(0编辑  收藏  举报