1. Objects used: Project manager or project manager
2. Database: MySQL
3. Fast location Slow query:
When you start MySQL, start the slow query log:
3.1 Window System:
First: Bin\mysqlid.exe--safe-mode--slow-query-log (configurable address in My.ini, default storage location: Datadir=c:/programdata/mysql/mysql Server 5.6/data);
The second (recommended): Modify the MySQL configuration file My.ini, locate the My.ini file, and add the following to the [mysqld]:
#代表MYSQL慢查询的日志存储目录, this directory file must have write permission;
Log-slow-queries= "C:/programfiles/mysql/mysqlserver5.5/log/mysql-slow.log"
#设置慢查询的时间, MySQL default slow query time is 10s, set according to the situation
Long_query_time =2
#没有使用到索引的查询也将被记录在日志中
Log-queries-not-using-indexes
Configure to restart a MySQL service later (otherwise the configuration is not valid)
3.2 Linux System:
Modify the MySQL configuration file my.cnf and add the following to [Mysqld]:
#设置慢查询的时间, mysql default slow query time is 10s, set long_query_time=2 according to the situation
#设置慢查询日志存放地址, set according to your own situation
Log-slow-queries=/usr/local/mysql/mysql-slow.log
Configure the MySQL service to restart later: /usr/local/mysql/libexec/mysqld restart
Note: as a project manager or project administrator, it is important to understand the merits and demerits of the developer's SQL query writing, a good query SQL, can improve the speed of the project access, give the user a good experience, and a poor SQL, not only slow the project access speed, It can also lead to the loss of user traffic, which is a fatal problem. Only in real-time grasp the query SQL writing, can be good to avoid unnecessary server overhead and user churn.
Note: To enable slow query configuration, use in a test environment and do not use in a build environment.
This article is from the "Yao Technology blog" blog, make sure to keep this source http://yaowusheng.blog.51cto.com/11020801/1853524
Teach you how to quickly locate a project in slow query [project management]