当前位置:网站首页>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 .
边栏推荐
- Regular expressions and calling related functions in C language
- 【C语言】通讯录动态版和文件版
- Overview of image classification of vision transformer must read series
- 排序问题:冒泡排序,选择排序,插入排序
- Gdown Access denied:Cannot retrieve the public link of the file.
- Why use the static keyword when defining methods
- Vision Transformer 必读系列之图像分类综述
- Integrated design of signal processing systems - Design of solver functions (continuous and discrete time systems)
- RNN循环神经网络
- 『期末复习』16/32位微处理器(8086)基本寄存器
猜你喜欢

Force buckle - 4. Find the median of two positive arrays

力扣——4. 寻找两个正序数组的中位数

Upgrade appium automation framework to the latest 2.0

If introduced according to the open source framework
![[nanny level] package volume optimization tutorial](/img/45/4ca66b10bb96efeb47501c07972d66.png)
[nanny level] package volume optimization tutorial

Vision Transformer 必读系列之图像分类综述

"Harmonyos" explore harmonyos applications

mysql优化之show profile的使用及分析

Children's programming electronic society graphical programming level examination scratch level 1 real problem analysis (multiple choice) June 2022

Deep learning - CV, CNN, RNN
随机推荐
[day_010418] delete public string
『HarmonyOS』工程的创建与虚拟机的使用
力扣——3. 无重复字符的最长子串
[day06_0423] C language multiple choice questions
信号处理系统综合设计-求解器函数的设计(连续和离散时间系统)
[C language] file operation
[Web3 series development tutorial - create your first NFT (4)] what can NFTs bring to you
Multi target detection
PG Vacuum 杂谈之 auto vacuum
[day_050422] continuous maximum sum
Do it yourself smart home: intelligent air conditioning control
[day_060423] convert string to integer
JVM class loading and GC garbage collection mechanism
Merge_sort
Go 的切片与数组
RNN循环神经网络
[image denoising] image denoising based on bicube interpolation and sparse representation matlab source code
What are the aspects of performance testing? What are the classification and testing methods?
深度学习——CV、CNN、RNN
力扣——4. 寻找两个正序数组的中位数