How to use pt-query-digest slow query Analysis tool
This article mainly introduces how to use the pt-query-digest slow query analysis tool, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.
1. The installation process is omitted because a previous dba has installed pt-query-digest on the server
Mainly describe how to use it
1. Locate the installation directory
You can use find /-name pt-query-digest or find /-name pt-query
Find the path at / usr/bin
Then enter the slow query log directory
Cd / var/log/mysql
[root@hs-dba-1 mysql] # ll
Total 732888
-rw-r--r-- 1 root root 31621 Mar 20 11:14 digest.log
-rw-rw---- 1 mysql mysql 16909390 Mar 20 10:19 mysql_error.log
-rw-r- 1 mysql mysql 16384 Dec 12 09:37 mysql_error.log_bak
-rw-rw---- 1 mysql mysql 559719 Mar 20 13:37 slow-query.log
-rw-r- 1 mysql mysql 1457 Nov 2618: 20 slowquery.log_20162618
-rwxrwxrwx 1 mysql mysql 1 Mar 14 16:58 slowquery.log_bak
-rw-r- 1 mysql mysql 732930070 Jan 3 17:53 slowquery.log_bak_20170103
You can see the slow query log slow-query.log
Then use the command
/ usr/bin/pt-query-digest slow-query.log > digest.log
Generate digest.log files in the current directory
Thank you for reading this article carefully. I hope the article "how to use pt-query-digest slow query Analysis tool" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!