SELECT `substring_index` ( `performance_schema` . `events_waits_summary_global_by_event_name` . `EVENT_NAME` , ?, ... ) AS `event_class` , SUM ( `performance_schema` . `events_waits_summary_global_by_event_name` . `COUNT_STAR` ) AS `total` , `sys` . `format_time` ( SUM ( `performance_schema` . `events_waits_summary_global_by_event_name` . `SUM_TIMER_WAIT` ) ) AS `total_latency` , `sys` . `format_time` ( MIN ( `performance_schema` . `events_waits_summary_global_by_event_name` . `MIN_TIMER_WAIT` ) ) AS `min_latency` , `sys` . `format_time` ( `ifnull` ( ( SUM ( `performance_schema` . `events_waits_summary_global_by_event_name` . `SUM_TIMER_WAIT` ) / `nullif` ( SUM ( `performance_schema` . `events_waits_summary_global_by_event_name` . `COUNT_STAR` ) , ? ) ) , ? ) ) AS `avg_latency` , `sys` . `format_time` ( MAX ( `performance_schema` . `events_waits_summary_global_by_event_name` . `MAX_TIMER_WAIT` ) ) AS `max_latency` FROM `performance_schema` . `events_waits_summary_global_by_event_name` WHERE ( ( 