首页 > 其他分享 >等待事件统计视图

等待事件统计视图

时间:2022-08-29 16:56:38浏览次数:60  
标签:latency waits 视图 事件 total 等待 统计 wait

在上一篇《内存分配统计视图 | 全方位认识 sys 系统库》中,我们介绍了sys 系统库如何查询内存事件统计信息和buffer pool统计信息,本期的内容先给大家介绍按照等待事件统计相关的视图(注意不要和《按 fie 分组统计视图|全方位认识 sys 系统库》介绍的内容搞混了,这篇中介绍的等待事件仅针对文件IO等待事件,而本篇介绍的是所有的等待事件)。下面请跟随我们一起开始 sys 系统库的系统学习之旅吧~

 

01
wait_classes_global_by_avg_latency,x$wait_classes_global_by_avg_latency
按照事件大类(等待事件名称层级中前三层组件组成的名称前缀)分组(如:wait/io/table、wait/io/file、wait/lock/table)的等待事件平均延迟时间(总IO延迟时间/总IOS)等统计信息,默认按照平均延迟时间(执行时间)降序排序。数据来源:events_waits_summary_global_by_event_name

该视图会忽略空闲等待事件(idle事件)信息

下面我们看看使用该视图查询返回的结果。

 

# 不带x$前缀的视图
admin@localhost : sys 12:58:11> select * from wait_classes_global_by_avg_latency limit 3;
+--------------------+-------+---------------+-------------+-------------+-------------+
| event_class | total | total_latency | min_latency | avg_latency | max_latency |
+--------------------+-------+---------------+-------------+-------------+-------------+
| wait/lock/metadata | 2 | 56.57 m | 12.94 m | 28.28 m | 43.63 m |
| wait/synch/cond | 7980 | 4.37 h | 0 ps | 1.97 s | 5.01 s |
| wait/io/socket | 28988 | 21.02 s | 0 ps | 725.29 us | 103.18 ms |
+--------------------+-------+---------------+-------------+-------------+-------------+
3 rows in set (0.05 sec)

# 带x$前缀的视图
admin@localhost : sys 12:58:22> select * from x$wait_classes_global_by_avg_latency limit 3;
+--------------------+-------+-------------------+-----------------+-----------------------+------------------+
| event_class | total | total_latency | min_latency | avg_latency | max_latency |
+--------------------+-------+-------------------+-----------------+-----------------------+------------------+
| wait/lock/metadata | 2 | 3393932470401750 | 776378395041375 | 1696966235200875.0000 | 2617554075360375 |
| wait/synch/cond | 7980 | 15739342570225500 | 0 | 1972348693010.7143 | 5006888904375 |
| wait/io/socket | 28990 | 21024710924250 | 0 | 725240114.6689 | 103181011500 |
+--------------------+-------+-------------------+-----------------+-----------------------+------------------+
3 rows in set (0.02 sec)
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
 

 

视图字段含义如下:

event_class:事件类别,事件名称层级中前三层组件组成的名称前缀,如'wait/io/file/sql/slow_log',截取后保留'wait/io/file' 字符串作为事件类别

total:对应事件大类的事件总次数

total_latency:对应事件大类的事件总延迟时间(执行时间)

min_latency:对应事件大类的单次事件最小延迟时间(执行时间)

avg_latency:对应事件大类中,每个事件的平均延迟时间(执行时间)

max_latency:对应事件大类的单次事件在最大延迟时间(执行时间)

 

02
wait_classes_global_by_latency,x$wait_classes_global_by_latency
按照事件大类(等待事件名称前三层前缀)分组(如:wait/io/table、wait/io/file、wait/lock/table)的等待事件平均延迟时间等统计信息,默认情况下按照总延迟时间(执行时间)降序排序。数据来源:events_waits_summary_global_by_event_name

下面我们看看使用该视图查询返回的结果。

 

# 不带x$前缀的视图
admin@localhost : sys 12:58:26> select * from wait_classes_global_by_latency limit 3;
+--------------------+----------+---------------+-------------+-------------+-------------+
| event_class | total | total_latency | min_latency | avg_latency | max_latency |
+--------------------+----------+---------------+-------------+-------------+-------------+
| wait/synch/cond | 7983 | 4.38 h | 0 ps | 1.97 s | 5.01 s |
| wait/lock/metadata | 2 | 56.57 m | 12.94 m | 28.28 m | 43.63 m |
| wait/io/table | 16096791 | 4.59 m | 12.03 us | 17.11 us | 2.02 m |
+--------------------+----------+---------------+-------------+-------------+-------------+
3 rows in set (0.02 sec)

# 带x$前缀的视图
admin@localhost : sys 12:58:40> select * from x$wait_classes_global_by_latency limit 3;
+--------------------+----------+-------------------+-----------------+-----------------------+------------------+
| event_class | total | total_latency | min_latency | avg_latency | max_latency |
+--------------------+----------+-------------------+-----------------+-----------------------+------------------+
| wait/synch/cond | 7984 | 15759344050722375 | 0 | 1973865737815.9287 | 5006888904375 |
| wait/lock/metadata | 2 | 3393932470401750 | 776378395041375 | 1696966235200875.0000 | 2617554075360375 |
| wait/io/table | 16096791 | 275441586767625 | 12026625 | 17111583.7168 | 121243803313125 |
+--------------------+----------+-------------------+-----------------+-----------------------+------------------+
3 rows in set (0.02 sec)
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
 

 

视图字段含义如下:

该视图字段含义和wait_classes_global_by_avg_latency,x$wait_classes_global_by_avg_latency 视图字段含义相同,只是排序字段不同而已

 

03
waits_by_host_by_latency,x$waits_by_host_by_latency
按照主机和事件名称分组的等待事件统计信息,默认情况下按照主机名和总的等待事件延迟时间降序排序,数据来源:events_waits_summary_by_host_by_event_name

该视图忽略空闲等待事件(idle事件)信息

下面我们看看使用该视图查询返回的结果。

 

# 不带x$前缀的视图
admin@localhost : sys 12:58:43> select * from waits_by_host_by_latency limit 3;
+-------------+----------------------------------------------+-------+---------------+-------------+-------------+
| host | event | total | total_latency | avg_latency | max_latency |
+-------------+----------------------------------------------+-------+---------------+-------------+-------------+
| 10.10.20.14 | wait/io/socket/sql/client_connection | 24568 | 20.53 s | 835.48 us | 70.46 ms |
| 10.10.20.14 | wait/synch/mutex/innodb/trx_pool_mutex | 2326 | 14.59 s | 6.27 ms | 215.63 ms |
| 10.10.20.14 | wait/synch/cond/sql/MYSQL_BIN_LOG::COND_done | 1707 | 13.74 s | 8.05 ms | 43.33 ms |
+-------------+----------------------------------------------+-------+---------------+-------------+-------------+
3 rows in set (0.00 sec)

# 带x$前缀的视图
admin@localhost : sys 12:59:04> select * from x$waits_by_host_by_latency limit 3;
+-------------+----------------------------------------------+-------+----------------+-------------+--------------+
| host | event | total | total_latency | avg_latency | max_latency |
+-------------+----------------------------------------------+-------+----------------+-------------+--------------+
| 10.10.20.14 | wait/io/socket/sql/client_connection | 24568 | 20526083640375 | 835480125 | 70457480625 |
| 10.10.20.14 | wait/synch/mutex/innodb/trx_pool_mutex | 2326 | 14586650782125 | 6271131000 | 215632752375 |
| 10.10.20.14 | wait/synch/cond/sql/MYSQL_BIN_LOG::COND_done | 1707 | 13737760876125 | 8047897125 | 43332152250 |
+-------------+----------------------------------------------+-------+----------------+-------------+--------------+
3 rows in set (0.01 sec)
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
 

 

视图字段含义如下:

host:发起连接的主机名

event:等待事件名称

total:对应主机发生的等待事件总次数

total_latency:对应主机的等待事件总延迟时间

avg_latency:对应主机的等待事件的平均延迟时间

max_latency:对应主机的单次等待事件的最大延迟时间

 

04
waits_by_user_by_latency,x$waits_by_user_by_latency
按照用户和事件名称分组的等待事件统计信息,默认情况下按照用户名和总的等待事件延迟事件降序排序,数据来源:events_waits_summary_by_user_by_event_name

该视图忽略空闲等待事件(idle事件)信息

下面我们看看使用该视图查询返回的结果。

 

# 不带x$前缀的视图
admin@localhost : sys 12:59:07> select * from waits_by_user_by_latency limit 3;
+-------+---------------------------------------------------+----------+---------------+-------------+-------------+
| user | event | total | total_latency | avg_latency | max_latency |
+-------+---------------------------------------------------+----------+---------------+-------------+-------------+
| admin | wait/lock/metadata/sql/mdl | 2 | 56.57 m | 28.28 m | 43.63 m |
| admin | wait/synch/cond/sql/MDL_context::COND_wait_status | 3395 | 56.56 m | 999.66 ms | 1.00 s |
| admin | wait/io/table/sql/handler | 16096791 | 4.59 m | 17.11 us | 2.02 m |
+-------+---------------------------------------------------+----------+---------------+-------------+-------------+
3 rows in set (0.01 sec)

# 带x$前缀的视图
admin@localhost : sys 12:59:22> select * from x$waits_by_user_by_latency limit 3;
+-------+---------------------------------------------------+----------+------------------+------------------+------------------+
| user | event | total | total_latency | avg_latency | max_latency |
+-------+---------------------------------------------------+----------+------------------+------------------+------------------+
| admin | wait/lock/metadata/sql/mdl | 2 | 3393932470401750 | 1696966235200875 | 2617554075360375 |
| admin | wait/synch/cond/sql/MDL_context::COND_wait_status | 3395 | 3393839154564375 | 999658071750 | 1004173431750 |
| admin | wait/io/table/sql/handler | 16096791 | 275441586767625 | 17111250 | 121243803313125 |
+-------+---------------------------------------------------+----------+------------------+------------------+------------------+
3 rows in set (0.01 sec)
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
 

 

视图字段含义如下:

user:与该连接关联的用户名

其他字段与waits_by_host_by_latency,x$waits_by_host_by_latency 视图字段含义相同,不同的是waits_by_user_by_latency,x$waits_by_user_by_latency视图是按照用户名和事件名称分组

 

05
waits_global_by_latency,x$waits_global_by_latency
按照事件名称分组的等待事件统计信息,默认按照等待事件总延迟时间降序排序。数据来源:events_waits_summary_global_by_event_name

该视图忽略空闲等待事件(idle事件)信息

下面我们看看使用该视图查询返回的结果。

 

# 不带x$前缀的视图
admin@localhost : sys 12:59:25> select * from waits_global_by_latency limit 3;
+---------------------------------------------------+-------+---------------+-------------+-------------+
| events | total | total_latency | avg_latency | max_latency |
+---------------------------------------------------+-------+---------------+-------------+-------------+
| wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond | 2891 | 3.45 h | 4.29 s | 5.01 s |
| wait/lock/metadata/sql/mdl | 2 | 56.57 m | 28.28 m | 43.63 m |
| wait/synch/cond/sql/MDL_context::COND_wait_status | 3395 | 56.56 m | 999.66 ms | 1.00 s |
+---------------------------------------------------+-------+---------------+-------------+-------------+
3 rows in set (0.02 sec)

# 带x$前缀的视图
admin@localhost : sys 12:59:40> select * from x$waits_global_by_latency limit 3;
+---------------------------------------------------+-------+-------------------+------------------+------------------+
| events | total | total_latency | avg_latency | max_latency |
+---------------------------------------------------+-------+-------------------+------------------+------------------+
| wait/synch/cond/sql/MYSQL_BIN_LOG::update_cond | 2892 | 12411771548807250 | 4291760563125 | 5006888904375 |
| wait/lock/metadata/sql/mdl | 2 | 3393932470401750 | 1696966235200875 | 2617554075360375 |
| wait/synch/cond/sql/MDL_context::COND_wait_status | 3395 | 3393839154564375 | 999658071750 | 1004173431750 |
+---------------------------------------------------+-------+-------------------+------------------+------------------+
3 rows in set (0.02 sec)
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
 

 

 

视图字段含义如下:

events:等待事件名称

其他字段含义和waits_by_host_by_latency,x$waits_by_host_by_latency 视图字段含义相同,不同的是waits_global_by_latency,x$waits_global_by_latency视图只按照事件名称分组
-----------------------------------
等待事件统计视图 | 全方位认识 sys 系统库
https://blog.51cto.com/imysql/3171834

标签:latency,waits,视图,事件,total,等待,统计,wait
From: https://www.cnblogs.com/lovezhr/p/16636470.html

相关文章

  • 会话和锁信息查询视图
    在上一篇《等待事件统计视图|全方位认识sys系统库》中,我们介绍了sys系统库中的等待事件统计视图,本期的内容先给大家介绍会话信息和锁等待信息查询视图,通过这些视图我......
  • 按 user 分组统计视图
    在上一篇《按host分组统计视图|全方位认识sys系统库》中,我们介绍了sys系统库中按host分组统计的视图,类似地,本期的内容将为大家介绍按照user进行分类统计的视图。......
  • 按 host 分组统计视图
    在上一篇《配置表|全方位认识sys系统库》中,我们介绍了sys系统库的配置表,但实际上我们大部分人大多数时候并不需要去修改配置表,直接使用sys系统库下的视图来获取所需的......
  • Mysql的视图使用场景笔记
    mysql的视图本质上就是一条预定义的联表查询sql语句当设计一个数据库模型的时候,各个数据表模型之间的关系在一定程度上是独立的,即使两个数据模型表之间存在一对多或者多对......
  • js实现输入内容的实时字数统计
    效果输入内容的同时,字数会相应同步改变实现方式使用jQuery实现的,比较简单。$('#').bind('inputpropertychange',function(){$('#').text();});使用bind给......
  • MapReduce程序编写(举例:统计单词个数)
    publicclassWordCount{//map读取数据的key类型定死是LongWritable,代表的是行号,从0开始,value是一行数据,TextstaticclassMyMapperextendsMapper<LongWrita......
  • 《热力学·统计物理(第五、六版)》汪志诚
    https://wwz.lanzouy.com/iywAm0agikza密码:hpj1链接:https://caiyun.139.com/m/i?065CtborcdlGK 提取码:H4QL 复制内容打开中国移动云盘手机APP,操作更方便哦......
  • Drf视图集合
    1.背景:    技术储备,drf适合前后端分离项目,比较适合单表操作的业务,另外丰富的视图集合配合路由自动生成,开发速度能得到极大的提升。 2、视图分类:   ......
  • Flask 学习-22.可插拨视图MethodView类
    前言可插拨视图基于使用类来代替函数,其灵感来自于Django的通用视图。可插拨视图的主要用途是用可定制的、可插拨的视图来替代部分实现。基本原理假设有一个函数用于......
  • 2 - 增量代码覆盖率统计
    针对统计代码的不同,可以分为全量代码覆盖率统计和增量代码覆盖率统计全量统计较为简单,默认每次都是对全量代码进行统计的,但是由于版本开发过程中,每次都是增量代码迭代,而测......