如果我们的问题只是与具体MySQL表达式或函数有关,我们可以使用mysql客户程序所带的BENCHMARK()函数执行定时测试。其语法为:
BENCHMARK(loop_count,expression)
![]()
mysql> SELECT BENCHMARK(1000000,1+1);
+------------------------+
| BENCHMARK(1000000,1+1) |
+------------------------+
| 0 |
+------------------------+
1 row in set (0.13 sec)
![]()
mysql> set autocommit = 0;
Query OK, 0 rows affected (0.00 sec)
![]()
mysql> SELECT BENCHMARK(1000000,1+1);
+------------------------+
| BENCHMARK(1000000,1+1) |
+------------------------+
| 0 |
+------------------------+
1 row in set (0.03 sec)
