2019-02-25
閱讀量:
720
怎樣獲得mysql處理一個sql文件所用的毫秒數(shù)?
問題描述:
比如:source schema.sql; schema.sql中含有超過100條insert命令(所以profile基本上就用不著了),要怎么才能知道處理這個文件用了多少毫秒呢?
解決方法:
如果想要更精確的查詢時間 ... 你需要開啟 Profile
... 方法如下 ...
mysql> set profiling=1;
Query OK, 0 rows affected (0.00 sec)
mysql> select * from bigtable;
29121487 rows in set (0.00 sec)
mysql> show profiles;
+----------+------------+--------------------+
| Query_ID | Duration | Query |
+----------+------------+--------------------+
| 1 | 0.00026925 | select * from user |
+----------+------------+--------------------+
1 row in set (0.00 sec)
mysql> show profile;
+--------------------------------+----------+
| Status | Duration |
+--------------------------------+----------+
| starting | 0.000020 |
| Waiting for query cache lock | 0.000005 |
| checking query cache for query | 0.000028 |
| checking permissions | 0.000008 |
| Opening tables | 0.000019 |
| System lock | 0.000011 |
| init | 0.000033 |
| optimizing | 0.000006 |
| statistics | 0.000010 |
| preparing | 0.000009 |
| executing | 0.000004 |
| Sending data | 0.000078 |
| end | 0.000006 |
| query end | 0.000003 |
| closing tables | 0.000008 |
| freeing items | 0.000016 |
| logging slow query | 0.000004 |
| cleaning up | 0.000005 |
+--------------------------------+----------+
18 rows in set (0.00 sec)






評論(0)


暫無數(shù)據(jù)
推薦帖子
0條評論
0條評論
0條評論
1條評論