当前位置:网站首页>MySQL performance_ Schema common performance diagnosis query
MySQL performance_ Schema common performance diagnosis query
2022-07-07 05:54:00 【wzy0623】
--1、 What kind SQL Execution is the most ?
SELECT DIGEST_TEXT,COUNT_STAR,FIRST_SEEN,LAST_SEEN FROM events_statements_summary_by_digest ORDER BY COUNT_STAR DESC
--2、 What kind of SQL The average response time of is the most ?
SELECT DIGEST_TEXT,AVG_TIMER_WAIT FROM events_statements_summary_by_digest ORDER BY AVG_TIMER_WAIT DESC
--3、 What kind of SQL The largest number of sorted records ?
SELECT DIGEST_TEXT,SUM_SORT_ROWS FROM events_statements_summary_by_digest ORDER BY SUM_SORT_ROWS DESC
--4、 What kind of SQL The largest number of scans ?
SELECT DIGEST_TEXT,SUM_ROWS_EXAMINED FROM events_statements_summary_by_digest ORDER BY SUM_ROWS_EXAMINED DESC
--5、 What kind of SQL Use temporary tables most ?
SELECT DIGEST_TEXT,SUM_CREATED_TMP_TABLES,SUM_CREATED_TMP_DISK_TABLES FROM events_statements_summary_by_digest ORDER BY SUM_CREATED_TMP_TABLES DESC
--6、 What kind of SQL Returns the most result sets ?
SELECT DIGEST_TEXT,SUM_ROWS_SENT FROM events_statements_summary_by_digest ORDER BY SUM_ROWS_SENT DESC
--7、 Which table Physics IO most ?
SELECT file_name,event_name,SUM_NUMBER_OF_BYTES_READ,SUM_NUMBER_OF_BYTES_WRITE FROM file_summary_by_instance ORDER BY SUM_NUMBER_OF_BYTES_READ + SUM_NUMBER_OF_BYTES_WRITE DESC
--8、 Which table logic IO most ?
SELECT object_name,COUNT_READ,COUNT_WRITE,COUNT_FETCH,SUM_TIMER_WAIT FROM table_io_waits_summary_by_table ORDER BY sum_timer_wait DESC
--9、 Which index is the most visited ?
SELECT OBJECT_NAME,INDEX_NAME,COUNT_FETCH,COUNT_INSERT,COUNT_UPDATE,COUNT_DELETE FROM table_io_waits_summary_by_index_usage ORDER BY SUM_TIMER_WAIT DESC
--10、 Which index has never been used ?
SELECT OBJECT_SCHEMA,OBJECT_NAME,INDEX_NAME FROM table_io_waits_summary_by_index_usage WHERE INDEX_NAME IS NOT NULL AND COUNT_STAR = 0 AND OBJECT_SCHEMA not in ('mysql','test') ORDER BY OBJECT_SCHEMA,OBJECT_NAME;
--11、 Which waiting event takes the most time ?
SELECT EVENT_NAME,COUNT_STAR,SUM_TIMER_WAIT,AVG_TIMER_WAIT FROM events_waits_summary_global_by_event_name WHERE event_name != 'idle' ORDER BY SUM_TIMER_WAIT DESC
--12-1、 Dissect a piece of SQL Implementation of , Include statement Information ,stege Information ,wait Information
SELECT EVENT_ID,sql_text FROM events_statements_history WHERE sql_text LIKE '%count(*)%';
--12-2、 Look at the time spent in each phase
SELECT event_id,EVENT_NAME,SOURCE,TIMER_END - TIMER_START FROM events_stages_history_long WHERE NESTING_EVENT_ID = 1553;
--12-3、 Look at the lock wait for each phase
SELECT event_id,event_name,source,timer_wait,object_name,index_name,operation,nesting_event_id FROM events_waits_history_long WHERE nesting_event_id = 1553;
边栏推荐
- Get the way to optimize the one-stop worktable of customer service
- Message queue: how to deal with message backlog?
- Simple case of SSM framework
- 集群、分布式、微服務的區別和介紹
- Determine whether the file is a DICOM file
- Modes of optical fiber - single mode and multimode
- I didn't know it until I graduated -- the principle of HowNet duplication check and examples of weight reduction
- 《2022中国低/无代码市场研究及选型评估报告》发布
- 如果不知道这4种缓存模式,敢说懂缓存吗?
- [cloud native] what is the microservice architecture?
猜你喜欢
[cloud native] what is the microservice architecture?
话说SQLyog欺骗了我!
Message queue: how to deal with message backlog?
Paper reading [MM21 pre training for video understanding challenge:video captioning with pre training techniqu]
Reptile exercises (III)
I didn't know it until I graduated -- the principle of HowNet duplication check and examples of weight reduction
毕业之后才知道的——知网查重原理以及降重举例
Distributed global ID generation scheme
Web architecture design process
bat 批示处理详解
随机推荐
Ten stages of becoming a Senior IC Design Engineer. What stage are you in now?
PowerPivot——DAX(函数)
PTA 天梯赛练习题集 L2-003 月饼 测试点2,测试点3分析
Flask1.1.4 werkzeug1.0.1 source code analysis: start the process
Flinksql read / write PgSQL
Web architecture design process
SQL Server 2008 各种DateTime的取值范围
Flinksql 读写pgsql
PTA 天梯赛练习题集 L2-004 搜索树判断
make makefile cmake qmake都是什么,有什么区别?
SQL query: subtract the previous row from the next row and make corresponding calculations
Explication contextuelle du langage Go
架构设计的五个核心要素
STM32 key state machine 2 - state simplification and long press function addition
Simple case of SSM framework
sql查询:将下一行减去上一行,并做相应的计算
What EDA companies are there in China?
Get the way to optimize the one-stop worktable of customer service
Three level menu data implementation, nested three-level menu data
Input of native applet switches between text and password types