WEB开发网
开发学院数据库MySQL Mysql教程:性能跟踪语句 阅读

Mysql教程:性能跟踪语句

 2008-08-30 11:07:25 来源:WEB开发网   
核心提示:原文链接:http://blog.chinaunix.net/u/29134/showart_480834.htmlMYSQL5.0家族提供的性能跟踪器确实很爽,要注意两点,Mysql教程:性能跟踪语句,1、不过版本要在5.0.37之后手册上介绍:(SHOW PROFILES and SHOW PROFILE were

原文链接:http://blog.chinaunix.net/u/29134/showart_480834.html

MYSQL5.0家族提供的性能跟踪器确实很爽。

要注意两点。

1、不过版本要在5.0.37之后

手册上介绍:(SHOW PROFILES and SHOW PROFILE were added in MySQL 5.0.37. )

Important

Please note that the SHOW PROFILE and SHOW PROFILES functionality is part of the MySQL 5.0 Community Server only.

2、变量profiling是用户变量,每次都得重新启用。

以下是我做的一些实验。数据很明显,就不多解释了。

mysql> use test

Database changed

mysql> set profiling=1;

Query OK, 0 rows affected (0.00 sec)

mysql> show tables;

+----------------+

| Tables_in_test |

+----------------+

| bag_item |

| bag_user |

| score |

| t |

+----------------+

4 rows in set (0.03 sec)

mysql> select count(*) from t;

+----------+

| count(*) |

+----------+

| 2097152 |

+----------+

1 row in set (0.74 sec)

mysql> show profiles;

+----------+------------+------------------------+

| Query_ID | Duration  | Query         |

+----------+------------+------------------------+

|    1 | 0.02717000 | show tables      |

|    2 | 0.74770100 | select count(*) from t |

+----------+------------+------------------------+

2 rows in set (0.00 sec)

1 2 3 4 5 6  下一页

Tags:Mysql 教程 性能

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接