首頁 > 資料庫 > mysql教程 > Find out slow sql of mysql_MySQL

Find out slow sql of mysql_MySQL

WBOY
發布: 2016-06-01 13:31:02
原創
869 人瀏覽過

bitsCN.com

Find out slow sql of mysql

 

Recent days, I should do a sql tuning for a mysql database, and I know a bit of mysql db. In order to find the slow sql, i do the slow_query_log on to collect the slow sql.

 

[sql]mysql> show variables like 'slow%';  +---------------------+-------------------------------------------+  | Variable_name       | Value                                     |  +---------------------+-------------------------------------------+  | slow_launch_time    | 2                                         |  | slow_query_log      | ON                                        |  | slow_query_log_file | /opt/mysql_data/mysql/mysql-test-slow.log |  +---------------------+-------------------------------------------+  3 rows in set (0.00 sec)    mysql> set global slow_launch_time=5;  Query OK, 0 rows affected (0.00 sec)    mysql> show variables like 'slow%';  +---------------------+-------------------------------------------+  | Variable_name       | Value                                     |  +---------------------+-------------------------------------------+  | slow_launch_time    | 5                                         |  | slow_query_log      | ON                                        |  | slow_query_log_file | /opt/mysql_data/mysql/mysql-test-slow.log |  +---------------------+-------------------------------------------+  3 rows in set (0.00 sec)  We can read  /opt/mysql_data/mysql/mysql-test-slow.log  to find slow sql.
登入後複製

 


bitsCN.com
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板