mysq造百万测试数据



-- auto-generated definition
create table test1
(
    id      int auto_increment
        primary key,
    name    varchar(200) null,
    age     int          null,
    address varchar(200) null
);


DROP PROCEDURE IF EXISTS test_insert;
DELIMITER ;;
CREATE PROCEDURE test_insert ()
BEGIN

    DECLARE i int;
    set i=0;
    WHILE i<100000
        DO

            INSERT INTO test1 (name, age, address) VALUES (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  '')),
                                                          (replace(uuid(),  '-',  ''), i, replace(uuid(),  '-',  ''));
            SET i=i+1;
        END WHILE ;
    commit;

END;;
call test_insert () ;


你可能感兴趣的:(mysq造百万测试数据)