Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Daily use of pt-query-digest

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Pt-query-digest is a tool for analyzing mysql slow queries. It can analyze binlog, General log, slowlog, or MySQL protocol data captured by SHOWPROCESSLIST or tcpdump. It can be said that pt-query-digest is an artifact of mysql slow log analysis. Here are some common ways to use it:

Pt-query-digest has the most complete help information: pt-query-digest-- help

1. Analyze the entire slow query log:

Pt-query-digest-report slow.log

two。 Specify a point in time for analysis:

Pt-query-digest mysql-slow.log-20180907-- since '2018-09-07 08 until'-- 2018-09-07 08 until'--VLV 25

3. Analyze the most recent point-in-time query, such as an hour:

Pt-query-digest-- since=1h slow.log > temp_slow_log.log

4. Analysis points can be accurate to seconds, such as reporting slow queries for the last half hour:

Pt-query-digest-report-since 1800s slow.log > temp_slow_log.log

5. Analyze a slow query for a user:

Pt-query-digest-- filter'($event- > {user} | | ") = ~ m / ^ db _ user_name/i' slow.log > temp_slow_log.log

Combination (for users and time):

Pt-query-digest-- filter'($event- > {user} | | ") = ~ m / ^ db _ user_name/i' mysql-slow.log-- since '2018-10-27 1800 event- 0000'-- until '2018-10-27 2323 Suzhou 590000' > temp_slow_log.log

The work is too busy to update constantly.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report