当前位置:网站首页>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 .
边栏推荐
- @Constructorproperties annotation understanding and its corresponding usage
- 『期末复习』16/32位微处理器(8086)基本寄存器
- Liberg avenue to Jane series
- Gdown Access denied:Cannot retrieve the public link of the file.
- 『牛客|每日一题』模板栈
- SQL optimization scheme
- [C language] file operation
- mysql优化之索引及索引失效
- The "darkest hour" has not come yet. Cherish every bullet 2020-03-22
- 深度学习——CV、CNN、RNN
猜你喜欢

【pytorch】微调技术

【故障诊断】基于贝叶斯优化支持向量机的轴承故障诊断附matlab代码

PG Vacuum 杂谈之 auto vacuum
![[image denoising] image denoising based on bicube interpolation and sparse representation matlab source code](/img/39/716c62d6ca533a7e84704b2c55d072.png)
[image denoising] image denoising based on bicube interpolation and sparse representation matlab source code

Jz36 binary search tree and bidirectional linked list

IP day 10 notes - BGP

【毕业季_进击的技术er】送别过去两年迷茫的自己。重整旗鼓,大三我来啦

Merge_sort

Design principle of infrared circuit of single chip microcomputer

『牛客|每日一题』模板栈
随机推荐
Why use the static keyword when defining methods
『期末复习』16/32位微处理器(8086)基本寄存器
TCP protocol -- message format, connection establishment, reliable transmission, congestion control
【pytorch】图片增广
English sentence pattern reference exclusive Edition - adverbial clause
[day_040421] calculate candy
力扣——4. 寻找两个正序数组的中位数
【无标题】
CS5801_HDMI转EDP优势替代LT6711A方案
Map集合继承结构
How does the seckill system ensure that the database does not crash and prevent oversold goods
数据库中varchar和Nvarchar区别与联系
定义方法时为什么使用static关键字
[day_020419] inverted string
[untitled]
CONDA virtual environment envs directory is empty
How can machinery manufacturing enterprises do well in production management with the help of ERP system?
C language file operation
@Constructorproperties annotation understanding and its corresponding usage
[day_070425] legal bracket sequence judgment