免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2070 | 回复: 0
打印 上一主题 下一主题

mysql profile参数 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-09-01 21:52 |只看该作者 |倒序浏览
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
有了这个工具,查看系统性能还是很有用的。
本文来自CSDN博客,转载请标明出处:
http://blog.csdn.net/1satellite1/archive/2008/04/06/2255508.aspx


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u1/44726/showart_2043350.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP