性能测试--造100W数据

第一种方法:sql存储过程


delimiter //
CREATE PROCEDURE BatchInsertCustomer(IN start INT,IN loop_time INT)
  BEGIN
      DECLARE Var INT;
      DECLARE id INT;
      SET Var = 0;
      SET id= start;
      WHILE Var < loop_time DO
          insert into base_patient_copy2(id,user_id,........,tag,descri) 
          values (CONCAT('LQ',id), '2c9180887398936c0173911111111', NULL, NULL, .........., '1', NULL, '');
          SET Var = Var + 1;
          SET id= id + 1;
      END WHILE;
  END;
  //
delimiter ;

call BatchInsertCustomer(1,1000000)

 

 

 

---第二种方式:蠕虫,指数增长
重新复制一个表,清空数据,右键--设计表,主键id设置未int,勾选--自动递增

----第一次,重原表copy部分数据
INSERT into base_patient_copy1(user_id,main_patient_id,imei,realname,gender,type,id_number,birthday,cellphone,org_code,area,addr,relation,realname_level,permission,promoter,created_by,created_by_name,created_at,updated_by,updated_by_name,updated_at,data_version,deleted_status,deleted_at,height,weight,waistline,head_portrait_url,bim,bloody,marriage,professional,living_habits,live_address,cellphone1,is_common_used,is_get_card,tag,descri) SELECT user_id,main_patient_id,imei,realname,gender,type,id_number,birthday,cellphone,org_code,area,addr,relation,realname_level,permission,promoter,created_by,created_by_name,created_at,updated_by,updated_by_name,updated_at,data_version,deleted_status,deleted_at,height,weight,waistline,head_portrait_url,bim,bloody,marriage,professional,living_habits,live_address,cellphone1,is_common_used,is_get_card,tag,descri from base_patient;

----第n次执行蠕动
SELECT count(1) from base_patient_copy1;
INSERT into base_patient_copy1(user_id,main_patient_id,imei,realname,gender,type,id_number,birthday,cellphone,org_code,area,addr,relation,realname_level,permission,promoter,created_by,created_by_name,created_at,updated_by,updated_by_name,updated_at,data_version,deleted_status,deleted_at,height,weight,waistline,head_portrait_url,bim,bloody,marriage,professional,living_habits,live_address,cellphone1,is_common_used,is_get_card,tag,descri) SELECT user_id,main_patient_id,imei,realname,gender,type,id_number,birthday,cellphone,org_code,area,addr,relation,realname_level,permission,promoter,created_by,created_by_name,created_at,updated_by,updated_by_name,updated_at,data_version,deleted_status,deleted_at,height,weight,waistline,head_portrait_url,bim,bloody,marriage,professional,living_habits,live_address,cellphone1,is_common_used,is_get_card,tag,descri from base_patient_copy1;

再讲主键改回char即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值