To run mysqldumpslowpl (this is a perl program), download the perl compiler. : Http: panbaiducoms1i3GLKAp is activeperl_516230201712913msi. after installation, add the bin to the environment variable path. To run mysqldumpslow. pl (this is a perl program), download the perl compiler. : Http://pan.baidu.com/s/1i3GLKAp
Activeperl_5.16.2.3020.12913.msi. after installation, add the bin to the environment variable path.
Now let's assume a scenario:On-site slow. log is taken back. what should I do if I want to analyze it on mysql in a local windows environment?
C: \ Program Files \ MySQL Server 5.6 \ bin> perl mysqldumpslow. pl -- help
Usage: mysqldumpslow [OPTS...] [LOGS...]
Parse and summarize the MySQL slow query log. Options are
-- Verbose
-- Debug
-- Help write this text to standard output
-V verbose
-D debug
-S ORDER what to sort by (al, at, ar, c, l, r, t), 'at' is default
Al: average lock time
Ar: average rows sent
At: average query time
C: count
L: lock time
R: rows sent
T: query time
-R reverse the sort order (largest last instead of first)
-T NUM just show the top n queries
-A don't abstract all numbers to N and strings to's'
-N NUM abstract numbers with at least n digits within names
-G PATTERN grep: only consider into Ts that include this string
-H HOSTNAME hostname of db server for *-slow. log filename (can be wildcard ),
Default is '*', I. e. match all
-I NAME name of server instance (if using mysql. server startup script)
-L don't subtract lock time from total time
1.-s, sorting, c, t, l, r, and ac, at, al, and ar are sorted by query times, time, lock time, and returned Records respectively. Adding a is inverted.
2.-t, top n. keep up with the number to calculate the top number.
3.-g, followed by a regular expression.
C: \ Program Files \ MySQL Server 5.6 \ bin> mysqldumpslow. pl-r-s c-a-t> E: \ slow.txt
If this operation is performed, an error is reported. add some parameters in my. ini according to the error message. The result of the analysis is in slotestxt, as follows:
Count: 23 Time = 505.55 s (11627 s) Lock = 0.00 s (0 s) Rows = 30740.8 (707039), username [password] @ [10.194.172.41]
Select distinct u. name, o. full_name FROM pub_user u, pub_user_org uo, pub_org o WHERE u. user_id = uo. user_id
AND uo.org _ id = o.org _ id and u. del_flag = N and uo. del_flag = N
And u. account not like's and u. account not like's 'group by u. user_id
Count: 4 Time = 375.01 s (1500 s) Lock = 0.00 s (0 s) Rows = 10200.3 (40801), username [password] @ [10.194.172.41]
Select distinct username, pu. name, po. full_name from pub_login_history as plh
Inner join pub_user as pu on plh. username = pu. user_id
Inner join pub_user_org as puo on pu. user_id = puo. user_id
Inner join pub_org as po on puo.org _ id = po.org _ id
Where TIMESTAMPDIFF (MINUTE, login_time, logout_time)> = N
And login_time>'s and login_time <'s'
Count: 4 (number of executions) Time = 375.01 s (Time of each execution) (1500 s) (total execution Time) Lock = 0.00 s (0 s) (Lock wait time) Rows = 10200.3 (number of records returned each time) (40801) (total number of records returned), username [password] @ [10.194.172.41]