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

Analyze the number of operations on the table during the time period

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Analyze the number of select, insert, update, delete of the table in a certain period of time. You need to use pt-query-digest, a tool in the percona-toolkit package, with the following script:

[root@syk ~] # cat get_list.sh #! / bin/bashset-x#slow_file=ai-db1-slow.logslow_file=$1if [$#! = 1]; then echo "USAGE: $0 slow.log" echo "e.g.: $0 api-db1-slow.log" exit 1 Fipt-query-digest-- limit 10000 $slow_file > / tmp/tmp_filebn= `grep-n "# 10x" / tmp/tmp_file | awk-F':'{print $1} '`tn= `grep-n "# Query 1:" / tmp/tmp_file | awk-F':'{print $1} '`en= `expr $tn-2`sed-n "$bn,$en" p/tmp / tmp_file > / tmp/table_filecat / tmp/table_file | awk' {print $6 "," $9 " "$10}'> / tmp/table_source/usr/local/mysql/bin/mysql-uroot-pxxxxxxxx-S / tmp/mysql_3308.sock

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