请问MYSQL有没有不输出query结果只输出query执行时间的方法? 比如说我要测试select * from t1,t2的执行时间两个TABLE都有上千万行,明显打印是不可能的请问有没有办法不输出query结果只输出query执行时间的方法? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select count(*) from (select * from t1,t2);这样试一下,虽然会有 count(*)对测试结果有些影响。但基本上做对比测试应该可以了 mysql> set profiling=1 -> ;Query OK, 0 rows affected (0.02 sec)mysql> show profiles -> ;Empty set (0.02 sec)mysql> select * from test;+----+-------+---------+-----+| id | class | name | age |+----+-------+---------+-----+| 1 | A | aaa | 20 || 2 | A | B | 25 || 3 | B | ddd | 30 || 4 | C | B | 40 || 5 | B | sssffff | 50 |+----+-------+---------+-----+5 rows in set (0.02 sec)mysql> show profile for query -> 1;+--------------------+----------+| Status | Duration |+--------------------+----------+| starting | 0.000147 || Opening tables | 0.000024 || System lock | 0.000010 || Table lock | 0.000015 || init | 0.000027 || optimizing | 0.000007 || statistics | 0.000019 || preparing | 0.000012 || executing | 0.000005 || Sending data | 0.006949 || end | 0.000009 || query end | 0.000006 || freeing items | 0.000097 || logging slow query | 0.000004 || cleaning up | 0.000005 |+--------------------+----------+15 rows in set (0.03 sec)mysql> show profile cpu for query 1;+--------------------+----------+----------+------------+| Status | Duration | CPU_user | CPU_system |+--------------------+----------+----------+------------+| starting | 0.000147 | NULL | NULL || Opening tables | 0.000024 | NULL | NULL || System lock | 0.000010 | NULL | NULL || Table lock | 0.000015 | NULL | NULL || init | 0.000027 | NULL | NULL || optimizing | 0.000007 | NULL | NULL || statistics | 0.000019 | NULL | NULL || preparing | 0.000012 | NULL | NULL || executing | 0.000005 | NULL | NULL || Sending data | 0.006949 | NULL | NULL || end | 0.000009 | NULL | NULL || query end | 0.000006 | NULL | NULL || freeing items | 0.000097 | NULL | NULL || logging slow query | 0.000004 | NULL | NULL || cleaning up | 0.000005 | NULL | NULL |+--------------------+----------+----------+------------+15 rows in set (0.00 sec)mysql> show profiles;+----------+------------+--------------------+| Query_ID | Duration | Query |+----------+------------+--------------------+| 1 | 0.00733250 | select * from test |+----------+------------+--------------------+1 row in set (0.00 sec) 你要具体时间吗?好像目前还没有想explain那样的语句 寻数模高手帮忙,求一关系式。 求助 求c++ 调用mysql存储过程的方法 mysql经典问题,谁遇到过? 在VC中通过ODBC连MYSQL数据库时出现的问题,紧急求助!! 数据库中英主席截取的问题! 出钱购买php + postgresql代码,有意者站内联系 300分求救怎样在Powerbuilder中连接MySql? mysql的自增与不自增,求解。(insert into a values(select max(id)+1 from a)) qt连接mysql诡异错误 mysql中怎么配置innodb引擎? 关于表合并和分割的问题
-> ;
Query OK, 0 rows affected (0.02 sec)mysql> show profiles
-> ;
Empty set (0.02 sec)mysql> select * from test;
+----+-------+---------+-----+
| id | class | name | age |
+----+-------+---------+-----+
| 1 | A | aaa | 20 |
| 2 | A | B | 25 |
| 3 | B | ddd | 30 |
| 4 | C | B | 40 |
| 5 | B | sssffff | 50 |
+----+-------+---------+-----+
5 rows in set (0.02 sec)mysql> show profile for query
-> 1;
+--------------------+----------+
| Status | Duration |
+--------------------+----------+
| starting | 0.000147 |
| Opening tables | 0.000024 |
| System lock | 0.000010 |
| Table lock | 0.000015 |
| init | 0.000027 |
| optimizing | 0.000007 |
| statistics | 0.000019 |
| preparing | 0.000012 |
| executing | 0.000005 |
| Sending data | 0.006949 |
| end | 0.000009 |
| query end | 0.000006 |
| freeing items | 0.000097 |
| logging slow query | 0.000004 |
| cleaning up | 0.000005 |
+--------------------+----------+
15 rows in set (0.03 sec)mysql> show profile cpu for query 1;
+--------------------+----------+----------+------------+
| Status | Duration | CPU_user | CPU_system |
+--------------------+----------+----------+------------+
| starting | 0.000147 | NULL | NULL |
| Opening tables | 0.000024 | NULL | NULL |
| System lock | 0.000010 | NULL | NULL |
| Table lock | 0.000015 | NULL | NULL |
| init | 0.000027 | NULL | NULL |
| optimizing | 0.000007 | NULL | NULL |
| statistics | 0.000019 | NULL | NULL |
| preparing | 0.000012 | NULL | NULL |
| executing | 0.000005 | NULL | NULL |
| Sending data | 0.006949 | NULL | NULL |
| end | 0.000009 | NULL | NULL |
| query end | 0.000006 | NULL | NULL |
| freeing items | 0.000097 | NULL | NULL |
| logging slow query | 0.000004 | NULL | NULL |
| cleaning up | 0.000005 | NULL | NULL |
+--------------------+----------+----------+------------+
15 rows in set (0.00 sec)
mysql> show profiles;
+----------+------------+--------------------+
| Query_ID | Duration | Query |
+----------+------------+--------------------+
| 1 | 0.00733250 | select * from test |
+----------+------------+--------------------+
1 row in set (0.00 sec)