MySQL Slow query analysis tool pt-query-digest

Source: Internet
Author: User
Tags percona

1. Introduction to Slow Queries

http://hllnihao.iteye.com/blog/1461472

2. Pt-query-digest Installation

http://blog.csdn.net/seteor/article/details/24017913

[Email protected]]# wget percona.com/get/pt-query-digest [[email protected]]# chmod u+x pt-query-digest

3. Use

(1) Direct Parse slow query file: PT-query-digest Slow.log >Slow_report.log (2) analyze queries within the last 12 Hours: PT-query-digest--since=12h slow.log >Slow_report2.log (3) Analysis of queries within a specified time range: PT-query-digest Slow.log--since'2014-04-17 09:30:00'--until'2014-04-17 10:00:00'> >Slow_report3.log (4) analysis refers to slow queries with SELECT statements PT-query-digest--filter'$event->{fingerprint} =~ m/^select/i'Slow.log>Slow_report4.log (5) Slow query for a user pt-query-digest--filter'($event->{user} | | "") =~ m/^root/i'Slow.log>Slow_report5.log (6query all all full-table scans or slow queries of the complete join PT-query-digest--filter'(($event->{full_scan} | | "") eq "yes") | | (($event->{full_join} | | "") eq "yes")'Slow.log>Slow_report6.log (7) Save the query to the Query_review table PT-query-digest--user=root–password=abc123--review h=localhost,d=test,t=query_review--create-review-Table Slow.log (8) Save the query to the Query_history table PT-query-digest--user=root–password=abc123--review H=localhost,d=test,t=query_ history--create-review-Table slow.log_20140401pt-query-digest--user=root–password=abc123--review h=localhost,d=test,t=query_history--create-review-Table slow.log_20140402 (9) Crawl the MySQL TCP protocol data through tcpdump and then analyze the tcpdump-S65535-x-nn-q-tttt-i any-c +Port3306>mysql.tcp.txtpt-query-digest--type tcpdump mysql.tcp.txt>Slow_report9.log (Ten) analysis Binlogmysqlbinlog MySQL-bin.000093> mysql-Bin000093.sqlpt-query-digest--type=binlog mysql-bin000093.sql >Slow_report10.log ( One) Analysis General Logpt-query-digest--type=genlog localhost.log >Slow_report11.log Official Document: http://www.percona.com/doc/percona-toolkit/2.2/pt-query-digest.html

MySQL Slow query analysis tool pt-query-digest

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.