waits_global_by_latency,x$waits_global_by_latency - xiaoboluo768/mysql-system-schema GitHub Wiki
-
按照事件名称分组的等待事件摘要信息,默认按照等待事件总等待时间降序排序。数据来源:events_waits_summary_global_by_event_name
- 该视图忽略空闲等待事件信息
-
waits_global_by_latency,x$waits_global_by_latency视图字段含义如下:
- events:等待事件名称
- 其他字段含义和2.3.50. waits_by_host_by_latency,x$waits_by_host_by_latency 视图字段含义相同,不同的是waits_global_by_latency,x$waits_global_by_latency视图只按照事件名称分组
-
视图定义语句
# waits_global_by_latency
CREATE OR REPLACE
ALGORITHM = MERGE
DEFINER = 'root'@'localhost'
SQL SECURITY INVOKER
VIEW waits_global_by_latency (
events, total, total_latency, avg_latency, max_latency
) AS
SELECT event_name AS event,
count_star AS total,
sys.format_time(sum_timer_wait) AS total_latency,
sys.format_time(avg_timer_wait) AS avg_latency,
sys.format_time(max_timer_wait) AS max_latency
FROM performance_schema.events_waits_summary_global_by_event_name
WHERE event_name != 'idle'
AND sum_timer_wait > 0
ORDER BY sum_timer_wait DESC;
# x$waits_global_by_latency
CREATE OR REPLACE
ALGORITHM = MERGE
DEFINER = 'root'@'localhost'
SQL SECURITY INVOKER
VIEW x$waits_global_by_latency (
events, total, total_latency, avg_latency, max_latency
) AS
SELECT event_name AS event,
count_star AS total,
sum_timer_wait AS total_latency,
avg_timer_wait AS avg_latency,
max_timer_wait AS max_latency
FROM performance_schema.events_waits_summary_global_by_event_name
WHERE event_name != 'idle'
AND sum_timer_wait > 0
ORDER BY sum_timer_wait DESC;
- 视图查询信息示例
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)
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)
上一篇: waits_by_user_by_latency,x$waits_by_user_by_latency视图 |