mysql profile参数

<script type="text/javascript"> </script> <script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"></script>
mysql查看系统性能的一个好东西
在mysql5.0.37以后才有

mysql> select @@profiling;
+-------------+
| @@profiling |
+-------------+
|           0 |
+-------------+
1 row in set (0.00 sec)

mysql> SET profiling = 1;
Query OK, 0 rows affected (0.00 sec)
使profile选项生效

mysql> show profiles;
Empty set (0.00 sec)

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select count(*) from user;
+----------+
| count(*) |
+----------+
|       22 |
+----------+
1 row in set (0.00 sec)

mysql> show profiles;
+----------+------------+---------------------------+
| Query_ID | Duration   | Query                     |
+----------+------------+---------------------------+
|        1 | 0.00000700 | SELECT DATABASE()         |
|        2 | 0.00030600 | show databases            |
|        3 | 0.00000600 | show tables               |
|        4 | 0.00010700 | select count(*) from user |
+----------+------------+---------------------------+
4 rows in set (0.01 sec)

mysql> show profile;
+--------------------------------+----------+
| Status                         | Duration |
+--------------------------------+----------+
| (initialization)               | 0.000004 |
| checking query cache for query | 0.000036 |
| Opening tables                 | 0.000006 |
| System lock                    | 0.000015 |
| Table lock                     | 0.000006 |
| init                           | 0.000007 |
| optimizing                     | 0.000006 |
| executing                      | 0.000012 |
| end                            | 0.000003 |
| query end                      | 0.000002 |
| freeing items                  | 0.000005 |
| closing tables                 | 0.000004 |
| logging slow query             | 0.000001 |
+--------------------------------+----------+
13 rows in set (0.00 sec)

mysql> show profile cpu,memory for query 4;
+--------------------------------+----------+----------+------------+
| Status                         | Duration | CPU_user | CPU_system |
+--------------------------------+----------+----------+------------+
| (initialization)               | 0.000004 | 0        | 0          |
| checking query cache for query | 0.000036 | 0        | 0          |
| Opening tables                 | 0.000006 | 0        | 0          |
| System lock                    | 0.000015 | 0        | 0          |
| Table lock                     | 0.000006 | 0        | 0          |
| init                           | 0.000007 | 0        | 0          |
| optimizing                     | 0.000006 | 0        | 0          |
| executing                      | 0.000012 | 0        | 0          |
| end                            | 0.000003 | 0        | 0          |
| query end                      | 0.000002 | 0        | 0          |
| freeing items                  | 0.000005 | 0        | 0          |
| closing tables                 | 0.000004 | 0        | 0          |
| logging slow query             | 0.000001 | 0        | 0          |
+--------------------------------+----------+----------+------------+
13 rows in set (0.00 sec)

不错把  根多的内容要看
help mysql profile
有了这个工具,查看系统性能还是很有用的。

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值