当前位置:网站首页>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;
边栏推荐
- Paper reading [semantic tag enlarged xlnv model for video captioning]
- MySQL-CentOS7通过YUM安装MySQL
- Three level menu data implementation, nested three-level menu data
- SQL query: subtract the previous row from the next row and make corresponding calculations
- Reading the paper [sensor enlarged egocentric video captioning with dynamic modal attention]
- English grammar_ Noun possessive
- Sidecar mode
- make makefile cmake qmake都是什么,有什么区别?
- 高级程序员必知必会,一文详解MySQL主从同步原理,推荐收藏
- Get the way to optimize the one-stop worktable of customer service
猜你喜欢
随机推荐
SQL query: subtract the previous row from the next row and make corresponding calculations
What are the common message queues?
Flinksql 读写pgsql
SQLSTATE[HY000][1130] Host ‘host. docker. internal‘ is not allowed to connect to this MySQL server
【已解决】记一次EasyExcel的报错【读取xls文件时全表读不报错,指定sheet名读取报错】
Interview skills of software testing
Get the way to optimize the one-stop worktable of customer service
Flinksql read / write PgSQL
Message queue: how to deal with message backlog?
Reading the paper [sensor enlarged egocentric video captioning with dynamic modal attention]
What is make makefile cmake qmake and what is the difference?
关于服装ERP,你知道多少?
[云原生]微服务架构是什么?
Dynamic memory management
[solved] record an error in easyexcel [when reading the XLS file, no error will be reported when reading the whole table, and an error will be reported when reading the specified sheet name]
Data storage 3
zabbix_get测试数据库失败
2pc of distributed transaction solution
PTA 天梯赛练习题集 L2-002 链表去重
如何提高网站权重