询问 :Select C1 , C2, C3 from Table where C3='1'; -- 40571 rows in set (0.079 sec)
获取查询计数:
做 :Select count(*) from (Select C1 , C2, C3 from Table where C3='1') as X;
时间:0.035 秒
将输出重定向到/dev/null:
做 :time mysql -u'user' -p'password' Database < query.sql > /dev/null
时间 :
real 0m0.180s
user 0m0.112s
sys 0m0.005s
使用 mysqlslap :
做 :
vi query1.sql // Addin the query.
mysqlslap -u'user' -p'password' --query="query1.sql" --delimiter=";" --concurrency=1 >> output.log
Time :
mysqlslap: [Warning] Using a password on the command line interface can be insecure.
Benchmark
Average number of seconds to run all queries: 0.080 seconds
Minimum number of seconds to run all queries: 0.080 seconds
Maximum number of seconds to run all queries: 0.080 seconds
Number of clients running queries: 1
Average number of queries per client: 1
仅获取查询的执行时间而不打印结果集的解决方案:
询问 :
Select C1 , C2, C3 from Table where C3='1'; -- 40571 rows in set (0.079 sec)
获取查询计数:
做 :
Select count(*) from (Select C1 , C2, C3 from Table where C3='1') as X;
时间:0.035 秒
将输出重定向到
/dev/null
:做 :
time mysql -u'user' -p'password' Database < query.sql > /dev/null
时间 :
使用 mysqlslap :
做 :
根据我的理想是使用第三个解决方案
mysqlslap