当前位置:网站首页>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 .
边栏推荐
- Go 的通道channel
- Downloadutilse tool class without error
- Map collection inheritance structure
- IP day 10 notes - BGP
- 【图像去噪】基于双立方插值和稀疏表示实现图像去噪matlab源码
- Quick sort
- Valid bracket sequence of "Niuke | daily question"
- [image hiding] digital image watermarking method technology based on hybrid dwt-hd-svd with matlab code
- [Web3 series development tutorial - create your first NFT (4)] what can NFTs bring to you
- Do you think you are a reliable test / development programmer? "Back to the pot"? Surface and reality
猜你喜欢

『HarmonyOS』DevEco的下载安装与开发环境搭建
![[1]数学建模基础入门知识](/img/29/90b1c7533e9443852758d10080e239.png)
[1]数学建模基础入门知识

How does the seckill system ensure that the database does not crash and prevent oversold goods

【无标题】

Sorting problem: bubble sort, select sort, insert sort

Quick sort

@ConstructorProperties注解理解以及其对应使用方式

Why the server is stuck

深度学习——CV、CNN、RNN

Find the original root
随机推荐
YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
Liberg avenue to Jane series
Force deduction 5: Longest palindrome substring
Tiktok web s_ v_ web_ Analysis and implementation of ID parameter generation
TCP protocol -- message format, connection establishment, reliable transmission, congestion control
Address resolution ARP Protocol
Downloadutilse tool class without error
【pytorch】图片增广
Do you think you are a reliable test / development programmer? "Back to the pot"? Surface and reality
PG vacuum auto vacuum
少儿编程 电子学会图形化编程等级考试Scratch一级真题解析(选择题)2022年6月
JS date details, string to date
Three skills are needed to engage in SAP related work
Map dictionary and constraints of go
『HarmonyOS』探索HarmonyOS应用
Resume considerations
Input the records of 5 students (each record includes student number and grade), form a record array, and then output them in order of grade from high to low The sorting method adopts selective sortin
[day04_0421] C language multiple choice questions
C language introduction practice (8): switch case calculates the month, year and day of the next day (normal year / leap year calculation)
[day_030420] numbers that appear more than half of the time in the array