当前位置:网站首页>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
边栏推荐
- 综合能力测评系统
- C#(二十七)之C#窗体应用
- Network security - Security Service Engineer - detailed summary of skill manual (it is recommended to learn and collect)
- 使用JS完成一个LRU缓存
- How to execute an SQL statement in MySQL
- Record the pit of NETCORE's memory surge
- About some basic DP -- those things about coins (the basic introduction of DP)
- mysql关于自增长增长问题
- 【leetcode】1189. Maximum number of "balloons"
- Facebook and other large companies have leaked more than one billion user data, and it is time to pay attention to did
猜你喜欢
[disassembly] a visual air fryer. By the way, analyze the internal circuit
【FPGA教程案例11】基于vivado核的除法器设计与实现
ESP32_ FreeRTOS_ Arduino_ 1_ Create task
C (thirty) C combobox listview TreeView
Do you know cookies, sessions, tokens?
WPF effect Article 191 box selection listbox
How to modify field constraints (type, default, null, etc.) in a table
math_ Derivative function derivation of limit & differential & derivative & derivative / logarithmic function (derivative definition limit method) / derivative formula derivation of exponential functi
Path of class file generated by idea compiling JSP page
Record an excel xxE vulnerability
随机推荐
C language -- structs, unions, enumerations, and custom types
【leetcode】1189. Maximum number of "balloons"
2/10 parallel search set +bfs+dfs+ shortest path +spfa queue optimization
Exchange bottles (graph theory + thinking)
MySql數據庫root賬戶無法遠程登陸解决辦法
简易博客系统
Chinese brand hybrid technology: there is no best technical route, only better products
[FPGA tutorial case 12] design and implementation of complex multiplier based on vivado core
Stable Huawei micro certification, stable Huawei cloud database service practice
[introduction to Django] 11 web page associated MySQL single field table (add, modify, delete)
脚本生命周期
登录mysql输入密码时报错,ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO/YES
How to standardize the deployment of automated testing?
MySQL about self growth
软考 系统架构设计师 简明教程 | 总目录
Database, relational database and NoSQL non relational database
Unity中几个重要类
Codeforces Round #770 (Div. 2) B. Fortune Telling
自动化测试的好处
KS003基于JSP和Servlet实现的商城系统