当前位置:网站首页>Use and analysis of show profile optimized by MySQL
Use and analysis of show profile optimized by MySQL
2022-07-26 06:39:00 【ganganlee】
show profile yes mysql Analysis provided sql One of my tools , Its function is to record the latest execution 15 strip sql sentence , And record sql Detailed time-consuming execution 、CPU、 Memory consumption , It can help us quickly locate sql Statement and optimize ,show profile The default is off , And only live in the current session after opening , In other words, it needs to be turned on before each use .
On state
1、 Check to see if it's on (on: Turn on ,off: close )
show variables like 'profiling'

2、 Turn on show profile
# This on state is session Level , It means that if you don't use it for a while, it will turn off automatically
set profiling=on;

To analyze
Do something casually first sql sentence , Skip here ...
1、 see profile list
show profiles;

If you execute show profiles appear
Empty set, Otherwise, it is not opened show profile; Otherwise, it is not implemented sql sentence
2、 function sql The diagnosis
# Here Query_ID Namely show profiles Query to the Query_ID
show profile cpu,block io for query Query_ID
It mainly depends on Duration Execution time of 
3、show profile Common query parameters of .
- ALL: Show all overhead information .
- BLOCK IO: Display block IO expenses .
- CONTEXT SWITCHES: Context switching overhead .
- CPU: Show CPU Overhead information .
- IPC: Show send and receive overhead information .
- MEMORY: Display memory overhead information .
- PAGE FAULTS: Display page error overhead information .
- SOURCE: Display and Source_function,Source_file,Source_line Related expense information .
- SWAPS: Shows the number of exchanges overhead information .
4、 Optimization of diagnosis results
- If
ruguoconverting HEAP to MyISAM. Indicates that the query result is too large , Out of memory , Data moved to disk . - If
Creating tmp table. Indicates creating a temporary table . Copy the data to the temporary table first , Delete the temporary table after use . - If
Copying to tmp table on disk. Copy the temporary table in memory to disk , dangerous !!! - If
locked. Indicates that the table is locked during execution .
If in show profile The diagnosis showed that 4 Any one of the results , shows sql Statements need to be optimized .
边栏推荐
- The real epidemic situation in the United States, do not easily "bottom" 2020-03-23
- A tool for quickly switching local host files -- switchhosts
- PG Vacuum 杂谈之 auto vacuum
- Go 的切片与数组
- Alibaba cloud OSS binding custom domain name
- Interpretation of TPS motion (cvpr2022) video generation paper
- 『牛客|每日一题』 栈的压入、弹出序列
- [day_030420] find the longest consecutive number string in the string
- 使用Scanner从键盘获取多种数据类型
- 【C语言】文件操作
猜你喜欢

『HarmonyOS』工程的创建与虚拟机的使用

C language file operation
![[pytorch] picture enlargement](/img/79/2eeefcb4623156f65957d78997e138.jpg)
[pytorch] picture enlargement

『HarmonyOS』DevEco的下载安装与开发环境搭建

What is the concept and purpose of white box testing? And what are the main methods?
![[Web3 series development tutorial - create your first NFT (4)] what can NFTs bring to you](/img/57/f263f3f3c40b1440b0cbb58c5e05a5.jpg)
[Web3 series development tutorial - create your first NFT (4)] what can NFTs bring to you

【图像去噪】基于双立方插值和稀疏表示实现图像去噪matlab源码

【无标题】

UIToolkit中显示汉字

C# 可以利用反射给只读属性赋值吗?
随机推荐
【pytorch】微调技术
Multi target detection
Map dictionary and constraints of go
Decomposing a positive integer into prime factors requires decomposing into as many factors as possible.
Liberg avenue to Jane series
[day_040421] calculate candy
【无标题】
白盒测试的概念、目的是什么?及主要方法有哪些?
SQL optimization scheme
BigDecimal变为负数
力扣——4. 寻找两个正序数组的中位数
Three skills are needed to engage in SAP related work
BPG notes (IV)
Conda 虚拟环境envs目录为空
Force buckle - 4. Find the median of two positive arrays
[day_010418] delete public string
Downloadutilse tool class without error
『HarmonyOS』探索HarmonyOS应用
将金额数字转换为大写
Open includeexceptiondetailinfaults on the server (from servicebehaviorattribute or from & lt; servicedebug & gt; to configure behavior) to send exception information back