mysql中的show profiles在5.6.14版本被丢弃

来源:互联网 发布:微店和淘宝哪个安全 编辑:程序博客网 时间:2024/05/01 07:04

mysql> status
————–
mysql  Ver 14.14 Distrib 5.6.14, for Linux (x86_64) using  EditLine wrapper

mysql> show variables like ‘%profil%’;
+————————+——-+
| Variable_name          | Value |
+————————+——-+
| have_profiling         | YES   |
| profiling              | OFF   |
| profiling_history_size | 15    |
+————————+——-+
3 rows in set (0.00 sec)

该功能默认是关闭的

mysql> set profiling=1
-> ;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> show warnings\G
*************************** 1. row ***************************
Level: Warning
Code: 1287
Message: ‘SHOW PROFILE’ is deprecated and will be removed in a future release. Please use Performance Schema instead
1 row in set (0.00 sec)

mysql> select count(*) from openfire.ofUser;

mysql> show profile for query 2;
+———————-+———-+
| Status               | Duration |
+———————-+———-+
| starting             | 0.000046 |
| checking permissions | 0.000006 |
| Opening tables       | 0.000017 |
| init                 | 0.000014 |
| System lock          | 0.000009 |
| optimizing           | 0.000006 |
| statistics           | 0.000013 |
| preparing            | 0.000011 |
| executing            | 0.000003 |
| Sending data         | 0.000049 |
| end                  | 0.000005 |
| query end            | 0.000006 |
| closing tables       | 0.000009 |
| freeing items        | 0.000013 |
| logging slow query   | 0.000069 |
| cleaning up          | 0.000016 |
+———————-+———-+
16 rows in set, 1 warning (0.00 sec)

官方建议使用information_schema.profiling。原因是show profile 输出了查询执行的每个步骤及其花费的时间,但是结果很难快速确定哪个步骤花费的时间最多,因为输出是按照执行顺序排序的,而不是按花费的时间排序—-而时间上我们更关心的是花费了多少时间。

0 0
原创粉丝点击