mysql slow query log

1. Common view the configuration of the statement

- data storage directory database
Show Variables like ' dataDir ';

- whether to turn on slow query log
Show the Variables like ' % slow_query_log ';

- Slow query time
Show Variables like ' long_query_time ';
SET = 0 Global long_query_time

- slow query file storage methods and the default table file, using the actual project file
Show the Variables like ' log_output ';

2. How to use

1. Locate the path to store data

2. Locate the slow query log file

3. Log files related to interpretation

 4. aids:

Summary In addition to query other identical SQL, and the order of the results according to parameters specified in the output analysis.

1.) mysqldumpslow -s r -t 10 slow-mysql.log

Interpretation parameters:

-s order (c, t, l , r, at, al, ar) Sort: c: Total number t: Total Time l: Lock Time r: total number of lines  
-t top take several previously specified output as a result

2.) pt_query_digest

 

Guess you like

Origin www.cnblogs.com/Uzai/p/11258014.html
Recommended