当前位置:网站首页>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=5
explain :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
边栏推荐
- Exchange bottles (graph theory + thinking)
- Tips for using dm8huge table
- What is the difference between gateway address and IP address in tcp/ip protocol?
- [Key shake elimination] development of key shake elimination module based on FPGA
- IDEA编译JSP页面生成的class文件路径
- 记一次excel XXE漏洞
- How to standardize the deployment of automated testing?
- Global and Chinese markets for otolaryngology devices 2022-2028: Research Report on technology, participants, trends, market size and share
- Leetcode32 longest valid bracket (dynamic programming difficult problem)
- Stc8h development (XII): I2C drive AT24C08, at24c32 series EEPROM storage
猜你喜欢
食品行业仓储条码管理系统解决方案
10 exemples les plus courants de gestion du trafic istio, que savez - vous?
Exchange bottles (graph theory + thinking)
Stc8h development (XII): I2C drive AT24C08, at24c32 series EEPROM storage
10个 Istio 流量管理 最常用的例子,你知道几个?
Mysql数据库慢sql抓取与分析
Viewing and verifying backup sets using dmrman
WPF效果第一百九十一篇之框选ListBox
Path of class file generated by idea compiling JSP page
C#(二十七)之C#窗体应用
随机推荐
[FPGA tutorial case 12] design and implementation of complex multiplier based on vivado core
潘多拉 IOT 开发板学习(HAL 库)—— 实验9 PWM输出实验(学习笔记)
有条件地 [JsonIgnore]
[FPGA tutorial case 11] design and implementation of divider based on vivado core
如何修改表中的字段约束条件(类型,default, null等)
Database, relational database and NoSQL non relational database
Custom event of C (31)
[Zhao Yuqiang] deploy kubernetes cluster with binary package
Ks008 SSM based press release system
Path of class file generated by idea compiling JSP page
asp. Core is compatible with both JWT authentication and cookies authentication
【按鍵消抖】基於FPGA的按鍵消抖模塊開發
Global and Chinese markets for MRI safe implants 2022-2028: technology, participants, trends, market size and share Research Report
mysql关于自增长增长问题
[Key shake elimination] development of key shake elimination module based on FPGA
Network security - Security Service Engineer - detailed summary of skill manual (it is recommended to learn and collect)
80% of the diseases are caused by bad living habits. There are eight common bad habits, which are both physical and mental
math_ Derivative function derivation of limit & differential & derivative & derivative / logarithmic function (derivative definition limit method) / derivative formula derivation of exponential functi
How can programmers resist the "three poisons" of "greed, anger and ignorance"?
Ks003 mall system based on JSP and Servlet