存储过程制造压测数据

用workbench制造存储过程:

CREATE DEFINER=`oms`@`localhost` PROCEDURE `t_add`(num int)
BEGIN
    declare nowtime bigint;
    declare i int;
    set nowtime = DATE_FORMAT(NOW() ,'%y%m%d%h%i%s');
    set i=0;
    while i<num do
        insert into cloudshopwareo2o_development.taobao_trade values ('fixed', NOW(), concat(nowtime,i+1), now(), '0', '西域贡枣', 'express', NULL, '~k6NGlKq3YzlBmSQlDUVR9H7+jahhHXTj+l96BEemkJ8=~1~', 'd[s100971416]', '0', NULL, '2018031221001001230540420261', NULL, now(), now(), '0', '~4hS7IrEodDSVxDQ0yxhZ3A==~1~', '~IrYOEqV0My30ErU6ZiXipw==~1~', '杭州市', '滨江区', '西*街道**大厦B座**楼', '$152$7Pm6w9CJU1RTRMY6QCurFg==$1$', NULL, NULL, '~d3EWvQDW1i3T+fhJLFWH5MxQqoDvfulywu+ESMAaATg=~1~', '0', '000000', NULL, NULL, NULL, NULL, '0', '0', '0', '0', 'NEW_CREATED', '0', '0', NULL, '0', NULL, NULL, 'TAOBAO', NULL, '浙江省', 'maming425@163.com', '0.01', '0', '0', '0', '1', '0.01', 'https://img.alicdn.com/bao/uploaded/i4/1080291063/TB283gmbWmWBuNjy1XaXXXCbXXa_!!1080291063.jpg', '0.01', 'TRADE_CLOSED', NULL, NULL, '0', '0', NULL, '565584271930', 'N', 'I', '2018-10-17 18:08:03', '0', NULL, '0', NULL, NULL, '0', NULL, '4', '西域贡枣');
        set i=i+1;
    end while;
END

 

调用

call cloudshopwareo2o_development.t_add(100);

调用方法:传送门

 

 

 

整体:

delimiter $$
use cloudshopwareo2o_development; -- 那个数据库
drop procedure if exists t_add; -- 如果存在t_add 存储过程则删除

create DEFINER=`oms`@`localhost` procedure t_add(num int);  -- 是谁创建了这个存储过程
begin
    declare nowtime bigint;  -- 声明变量
    declare i int;
    set nowtime = DATE_FORMAT(NOW() ,'%y%m%d%h%i%s');  -- 变量赋值
    set i=0;
    while i<num do -- 循环插入
        insert into cloudshopwareo2o_development.taobao_trade values ('fixed', NOW(), concat(nowtime,i+1), now(), '0', '西域贡枣', 'express', NULL, '~k6NGlKq3YzlBmSQlDUVR9H7+jahhHXTj+l96BEemkJ8=~1~', 'd[s100971416]', '0', NULL, '2018031221001001230540420261', NULL, now(), now(), '0', '~4hS7IrEodDSVxDQ0yxhZ3A==~1~', '~IrYOEqV0My30ErU6ZiXipw==~1~', '杭州市', '滨江区', '西*街道**大厦B座**楼', '$152$7Pm6w9CJU1RTRMY6QCurFg==$1$', NULL, NULL, '~d3EWvQDW1i3T+fhJLFWH5MxQqoDvfulywu+ESMAaATg=~1~', '0', '000000', NULL, NULL, NULL, NULL, '0', '0', '0', '0', 'NEW_CREATED', '0', '0', NULL, '0', NULL, NULL, 'TAOBAO', NULL, '浙江省', 'maming425@163.com', '0.01', '0', '0', '0', '1', '0.01', 'https://img.alicdn.com/bao/uploaded/i4/1080291063/TB283gmbWmWBuNjy1XaXXXCbXXa_!!1080291063.jpg', '0.01', 'TRADE_CLOSED', NULL, NULL, '0', '0', NULL, '565584271930', 'N', 'I', '2018-10-17 18:08:03', '0', NULL, '0', NULL, NULL, '0', NULL, '4', '西域贡枣');
        set i=i+1;
    end while;
end;$$

call t_add(100); -- 调用存储过程,插入100条数据

 

posted @ 2018-12-16 21:20  tooltime  阅读(606)  评论(0编辑  收藏  举报