mysql5.6.20 using mysqldumpslow.pl to analyze slow logs under Windows

Source: Internet
Author: User
Tags mysql slow query log

To run mysqldumpslow.pl (This is a Perl program), Download the Perl compiler. : Http://pan.baidu.com/s/1i3GLKAp

Is Activeperl_5.16.2.3010812913.msi, step by step installation, add the bin to the environment variable path.

now suppose a scene: the scene of the Slow.log back, to the local Windows environment on the MySQL on the analysis, how to deal with it?

C:\Program Files\mysql\mysql Server 5.6\bin>Perl mysqldumpslow.pl--help
Usage:mysqldumpslow [OPTS ...] [LOGS ...]
Parse and summarize the MySQL slow query log. Options are
--verbose verbose
--debug 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), ' on ' 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-N and strings to ' S '
-N NUM abstract numbers with at least n digits within names
-G PATTERN Grep:only Consider stmts that include the 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, sort, c,t,l,r, and Ac,at,al,ar are sorted by query count, time, lock time, return record, respectively. Plus a is reverse.
2.-t,top N, follow the numbers to figure out how many top bars
3.-G, followed by regular expressions.

C:\Program files\mysql\mysql Server 5.6\bin> mysqldumpslow.pl-r-S c-a-T > E:\slow.txt

If you perform this error, just follow the error message and add some parameters to the My.ini. The results of the analysis are in Slow.txt, as follows:

count:23  time=505.55s (11627s)  lock=0.00s (0s)  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
& nbsp and u.account not like ' s ' and u.account don't like ' s ' Group by u.user_id

Count:4  time=375.01s (1500s)   lock=0.00s (0s)  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 joins 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
  login_time> ' s ' and login_time< ' s '


Count:4(How many times executed ) time=375.01s (time per execution) (1500s) (totaltime spent) lock=0.00s (0s)(time to wait for the lock) rows=10200.3(number of records returned each time ) (40801)(total number of records returned), Username[password]@[ 10.194.172.41]

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

mysql5.6.20 using mysqldumpslow.pl to analyze slow logs under Windows

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.