导入100w的测试表
链接:https://pan.baidu.com/s/1wgLz3qxncMx8N4eMX4k83Q 提取码:o3zw
source t100w.sql
压测命令: 未建立索引
mysqlslap --defaults-file=/etc/my.cnf --concurrency=100 --iterations=1 --create-schema='test' --query="select * from test.t100w where k2='780p'" engine=innodb --number-of-queries=200 -uroot -p123 -verbose
=====================
mysqlslap: [Warning] Using a password on the command line interface can be insecure.
Benchmark
Running for engine rbose
Average number of seconds to run all queries: 77.739 seconds
Minimum number of seconds to run all queries: 77.739 seconds
Maximum number of seconds to run all queries: 77.739 seconds
Number of clients running queries: 100
Average number of queries per client: 2
======================
建立合适索引
mysql> use test
mysql> alter table t100w add index idx_k2(k2);
再次 压测
mysqlslap --defaults-file=/etc/my.cnf --concurrency=100 --iterations=1 --create-schema='test' --query="select * from test.t100w where k2='780p'" engine=innodb --number-of-queries=200 -uroot -p123 -verbose
mysqlslap: [Warning] Using a password on the command line interface can be insecure.
Benchmark
Running for engine rbose
Average number of seconds to run all queries: 0.263 seconds
Minimum number of seconds to run all queries: 0.263 seconds
Maximum number of seconds to run all queries: 0.263 seconds
Number of clients running queries: 100
Average number of queries per client: 2