1. Install the Perl environment first.
2. Switch to the perl directory in the DOS environment. For example, my directory is
DOS command cd c: \ Perl \ bin
3. Enter the Perl mysqldumpslow path \ mysqldumpslow. pl + mysqldumpslow command + slow. Log Path + output location in this directory.
For example, the mysqldumpslow directory is
The slow. log directory is c: \ Perl \ bin \ slow. log.
The output file is time. txt, And the directory is E :\
The command parameters of mysqldumpslow are listed as follows:
-- Help: Output help information
-V: Output details
-D debugging
-S is sorted in descending order. The default value is 'at '.
AL: average lock table time
AR: Average number of result rows
At: Average query time
C: Times
L: Lock table time
R: Number of Summary Results
T: total query time
-R: sort in ascending order, that is, sort in ascending order.
-T num: Limit the number of entries displayed
-A shows numbers and strings. The default number is "N" and the string is "S'
-G pattern: filter the string, followed by a regular expression, such as the condition that '10 $ 'ends with 10
Example:
/Usr/local/MySQL/bin/mysqldumpslow-s t-a-t 3 slots txt
Sort by the total query time. Only the first three items are listed.
/Usr/local/MySQL/bin/mysqldumpslow-r-s c-a-t 3-g'hello' slow.txt
Search for results that contain the keyword "hello" and sort the first three results in the ascending order of the number of times.
This is original, reprint this log please indicate the source http://blog.163.com/zenglonglong525@126/