当前位置:网站首页>Slow SQL fetching and analysis of MySQL database
Slow SQL fetching and analysis of MySQL database
2022-07-06 04:08:00 【Spring breeze turns into autumn rain】
1、 modify mysql Configure slow startup sql Inquire about
Modify the configuration file /etc/my.cnf
slow_query_log=ON
slow_query_log_file=/usr/local/mysql/data/slow.log
long_query_time=5explain :long_query_time This time can be set as 1, Never let go of anything more than 1 Second query .
2、 Check the settings
show VARIABLES like '%slow_query_log%';
show VARIABLES like '%long_query_time%';


3、 Installation and installation pt_query_digest
wget percona.com/get/pt-query-digest
mv pt-query-digest /usr/bin/
chmod +x /usr/bin/pt-query-digest
Installation and Perl Related modules
yum -y install 'perl(Data::Dumper)'
yum -y install perl-Digest-MD5
yum -y install perl-DBI
yum -y install perl-DBD-MySQL
4、 Analysis of the slow sql Log files
# All
pt-query-digest slow.log > pt_slow_sql_report.log
# near 30 Days of
pt-query-digest --since=30d mysql.log > pt_slow_sql_report.rtf
The following is an example of analysis result interception , The analysis result document will give each slow sql Details of .
# 570.6s user time, 47s system time, 88.15M rss, 252.14M vsz
# Current date: Wed Jun 29 17:33:45 2022
# Hostname: izzm08qanynb5doqrznbeyz
# Files: mysql.log
# Overall: 722.25k total, 212 unique, 0.28 QPS, 2.88x concurrency ________
# Time range: 2022-05-30T17:25:05 to 2022-06-29T09:20:58
# Attribute total min max avg 95% stddev median
# ============ ======= ======= ======= ======= ======= ======= =======
# Exec time 7376702s 5s 122s 10s 24s 7s 7s
# Lock time 3079s 0 56s 4ms 204us 437ms 84us
# Rows sent 15.08M 0 32.56k 21.89 0.99 517.96 0.99
# Rows examine 3.11T 0 32.05M 4.52M 6.94M 2.51M 5.99M
# Query size 542.74M 27 5.86k 787.96 2.27k 907.02 299.03边栏推荐
- Basic use of MySQL (it is recommended to read and recite the content)
- Facebook等大厂超十亿用户数据遭泄露,早该关注DID了
- Maxay paper latex template description
- 《2022年中国银行业RPA供应商实力矩阵分析》研究报告正式启动
- Ybtoj coloring plan [tree chain dissection, segment tree, tarjan]
- Pandora IOT development board learning (HAL Library) - Experiment 9 PWM output experiment (learning notes)
- 深入浅出node模板解析错误escape is not a function
- Class A, B, C networks and subnet masks in IPv4
- User datagram protocol UDP
- P7735-[noi2021] heavy and heavy edges [tree chain dissection, line segment tree]
猜你喜欢

Stack and queue

MySQL about self growth

C#(三十)之C#comboBox ListView treeView

Développement d'un module d'élimination des bavardages à clé basé sur la FPGA

查询mysql数据库中各表记录数大小

WPF效果第一百九十一篇之框选ListBox

Tips for using dm8huge table

图应用详解

Simple blog system

Network security - Security Service Engineer - detailed summary of skill manual (it is recommended to learn and collect)
随机推荐
MySql数据库root账户无法远程登陆解决办法
Facebook等大厂超十亿用户数据遭泄露,早该关注DID了
Cf603e pastoral oddities [CDQ divide and conquer, revocable and search set]
DM8 backup set deletion
10 exemples les plus courants de gestion du trafic istio, que savez - vous?
No qualifying bean of type ‘......‘ available
Record an excel xxE vulnerability
1291_Xshell日志中增加时间戳的功能
In Net 6 CS more concise method
【FPGA教程案例12】基于vivado核的复数乘法器设计与实现
简易博客系统
ESP32(基于Arduino)连接EMQX的Mqtt服务器上传信息与命令控制
Fundamentals of SQL database operation
在 .NET 6 中使用 Startup.cs 更简洁的方法
2/13 qaq~~ greed + binary prefix sum + number theory (find the greatest common factor of multiple numbers)
Ipv4中的A 、B、C类网络及子网掩码
关于进程、线程、协程、同步、异步、阻塞、非阻塞、并发、并行、串行的理解
Script lifecycle
JVM的手术刀式剖析——一文带你窥探JVM的秘密
【按鍵消抖】基於FPGA的按鍵消抖模塊開發