MySQL查询优化:profile功能(3)

mysql> show profiles;
+----------+-------------+------------------------------------------------+
| Query_ID | Duration    | Query                                          |
+----------+-------------+------------------------------------------------+
|        1 |  0.02717000 | show tables                                    |
|        2 |  0.74770100 | select count(*) from t                        |
|        3 |  0.00004200 | show prifile for query 2                      |
|        4 | 34.30410100 | insert into t(username) select username from t |
|        5 |  1.50563800 | select count(*) from t                        |
+----------+-------------+------------------------------------------------+
5 rows in set (0.00 sec)

mysql> show profile cpu,block io,memory,swaps,context switches,source for query 5;
……
mysql> update t set username = 'waill';
Query OK, 4194304 rows affected (44.82 sec)
Rows matched: 4194304  Changed: 4194304  Warnings: 0

mysql> show profiles;
+----------+-------------+------------------------------------------------+
| Query_ID | Duration    | Query                                          |
+----------+-------------+------------------------------------------------+
|        1 |  0.02717000 | show tables                                    |
|        2 |  0.74770100 | select count(*) from t                        |
|        3 |  0.00004200 | show prifile for query 2                      |
|        4 | 34.30410100 | insert into t(username) select username from t |
|        5 |  1.50563800 | select count(*) from t                        |
|        6 | 44.82054700 | update t set username = 'waill'                |
+----------+-------------+------------------------------------------------+
6 rows in set (0.00 sec)

mysql> show profile cpu,block io,memory,swaps,context switches,source for query 6;

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/74dcb60173c972f3820dce9c80773154.html