时间:2021-07-01 10:21:17 帮助过:13人阅读
DROP PROCEDURE IF EXISTS proc1; DELIMITER $$ SET AUTOCOMMIT = 0$$ CREATE PROCEDURE proc1() BEGIN DECLARE v_cnt DECIMAL (10) DEFAULT 0 ; dd:LOOP INSERT INTO card (card_number) VALUES (UUID()); COMMIT; SET v_cnt = v_cnt+1 ; IF v_cnt = 10000000 THEN LEAVE dd; END IF; END LOOP dd ; END;$$ DELIMITER ;
3.调用存储过程,生成对应的测试数据
call proc1;
4.来测试一下性能吧。
select * from card order by rand() limit 1; //6.5秒查询完毕 select * from card where card_number like ‘%xxx%‘; //3.7秒查询完毕
mysql 快速生成百万条测试数据
标签:charset RoCE procedure sts round _id def table delay