• ADADADADAD

    生成大量测试数据脚本[ mysql数据库 ]

    mysql数据库 时间:2024-12-03 12:11:21

    作者:文/会员上传

    简介:

    生成大量数据来测试:
    create table t1 (id int not null primary key auto_increment,age int,name varchar(20),createtime date);
    create index idx_age_name_create on t1

    以下为本文的正文内容,内容仅供参考!本站为公益性网站,复制本文以及下载DOC文档全部免费。

    生成大量数据来测试:
    create table t1 (id int not null primary key auto_increment,age int,name varchar(20),createtime date);
    create index idx_age_name_create on t1(age,name,createtime);


    vi create-data.sh
    #!/bin/bash


    i=1;
    MAX_INSERT_ROW_COUNT=$1;
    while [ $i -le $MAX_INSERT_ROW_COUNT ]
    do
    mysql -uroot -p123456 test -e "insert into t1 (name,age,createtime) values ('HELLO$i',$i % 99,NOW());"
    d=$(date +%M-%d\ %H\:%m\:%S)
    echo "INSERT HELLO $i @@ $d"
    i=$(($i+1))
    sleep 0.05
    done


    exit 0




    执行:
    sh create-data.sh 10000
    生成大量测试数据脚本.docx

    将本文的Word文档下载到电脑

    推荐度:

    下载
    热门标签: 大量数据测试