events_statements_summary_by_host_by_event_name 详解

Posted by 道行尚浅 on September 2, 2021

系统表介绍

events_statements_summary_by_host_by_event_name

列名 含义
HOST 客户端IP
EVENT_NAME 事件名称
COUNT_STAR 事件汇总数量
SUM_TIMER_WAIT 事件总等待时间
MIN_TIMER_WAIT 事件最小等待时间
AVG_TIMER_WAIT 事件平均等待时间
MAX_TIMER_WAIT 事件最大等待时间
SUM_LOCK_TIME 总锁等待事件
SUM_ERRORS 总报错数量
SUM_WARNINGS 总警告数量
SUM_ROWS_AFFECTED 总涉及的行数
SUM_ROWS_SENT 总语句返回行数
SUM_ROWS_EXAMINED 在server层检查的行数(不包含在内部存储影响处理的数量)
SUM_CREATED_TMP_DISK_TABLES 总内部创建磁盘临时表的数量
SUM_CREATED_TMP_TABLES 总内部创建临时表的数量
SUM_SELECT_FULL_JOIN 总由于没有索引引起全表连接的数量
SUM_SELECT_FULL_RANGE_JOIN 总在引用表发生大范围扫描的次数
SUM_SELECT_RANGE 总在初始表使用范围方式获取记录的次数
SUM_SELECT_RANGE_CHECK 总判断是否要使用范围扫描的次数
SUM_SELECT_SCAN 总全表扫描次数
SUM_SORT_MERGE_PASSES 总再排序次数
SUM_SORT_RANGE 总范围扫描时按顺序读取记录的次数
SUM_SORT_ROWS 总排序的行数
SUM_SORT_SCAN 总全表扫描是按顺序读取的次数
SUM_NO_INDEX_USED 总标识是否使用索引
SUM_NO_GOOD_INDEX_USED 总标识是否使用好的索引

实例


mysql> select * from events_statements_summary_by_host_by_event_name  where count_star > 0  limit 2 \G;
*************************** 1. row ***************************
                       HOST: localhost
                 EVENT_NAME: statement/sql/select
                 COUNT_STAR: 73
             SUM_TIMER_WAIT: 88183796000
             MIN_TIMER_WAIT: 133612000
             AVG_TIMER_WAIT: 1207997000
             MAX_TIMER_WAIT: 5957850000
              SUM_LOCK_TIME: 10946000000
                 SUM_ERRORS: 1
               SUM_WARNINGS: 0
          SUM_ROWS_AFFECTED: 0
              SUM_ROWS_SENT: 3646
          SUM_ROWS_EXAMINED: 27448
SUM_CREATED_TMP_DISK_TABLES: 0
     SUM_CREATED_TMP_TABLES: 1
       SUM_SELECT_FULL_JOIN: 0
 SUM_SELECT_FULL_RANGE_JOIN: 0
           SUM_SELECT_RANGE: 0
     SUM_SELECT_RANGE_CHECK: 0
            SUM_SELECT_SCAN: 65
      SUM_SORT_MERGE_PASSES: 0
             SUM_SORT_RANGE: 0
              SUM_SORT_ROWS: 54
              SUM_SORT_SCAN: 8
          SUM_NO_INDEX_USED: 65
     SUM_NO_GOOD_INDEX_USED: 0
*************************** 2. row ***************************
                       HOST: localhost
                 EVENT_NAME: statement/sql/update
                 COUNT_STAR: 2
             SUM_TIMER_WAIT: 2533773000
             MIN_TIMER_WAIT: 876794000 
             AVG_TIMER_WAIT: 1266886000
             MAX_TIMER_WAIT: 1656979000
              SUM_LOCK_TIME: 677000000
                 SUM_ERRORS: 0
               SUM_WARNINGS: 0
          SUM_ROWS_AFFECTED: 1
              SUM_ROWS_SENT: 0
          SUM_ROWS_EXAMINED: 2044
SUM_CREATED_TMP_DISK_TABLES: 0
     SUM_CREATED_TMP_TABLES: 0
       SUM_SELECT_FULL_JOIN: 0
 SUM_SELECT_FULL_RANGE_JOIN: 0
           SUM_SELECT_RANGE: 0
     SUM_SELECT_RANGE_CHECK: 0
            SUM_SELECT_SCAN: 0
      SUM_SORT_MERGE_PASSES: 0
             SUM_SORT_RANGE: 0
              SUM_SORT_ROWS: 0
              SUM_SORT_SCAN: 0
          SUM_NO_INDEX_USED: 0
     SUM_NO_GOOD_INDEX_USED: 0
2 rows in set (0.00 sec)