These tables store wait events:
events_waits_current: Current
wait events
events_waits_history: The most
recent wait events for each thread
events_waits_history_long: The
most recent wait events overall
The following sections describe those tables. There are also summary tables that aggregate information about wait events; see Section 22.10.9.1, “Wait Event Summary Tables”.
To enable collection of wait events, enable the relevant instruments and consumers.
The setup_instruments table
contains instruments with names that begin with
wait. For example:
mysql>SELECT * FROM setup_instrumentsWHERE NAME LIKE 'wait/io/file/innodb%';+--------------------------------------+---------+-------+ | NAME | ENABLED | TIMED | +--------------------------------------+---------+-------+ | wait/io/file/innodb/innodb_data_file | YES | YES | | wait/io/file/innodb/innodb_log_file | YES | YES | | wait/io/file/innodb/innodb_temp_file | YES | YES | +--------------------------------------+---------+-------+ mysql>SELECT * FROM setup_instruments WHERENAME LIKE 'wait/io/socket/%';+----------------------------------------+---------+-------+ | NAME | ENABLED | TIMED | +----------------------------------------+---------+-------+ | wait/io/socket/sql/server_tcpip_socket | NO | NO | | wait/io/socket/sql/server_unix_socket | NO | NO | | wait/io/socket/sql/client_connection | NO | NO | +----------------------------------------+---------+-------+
To modify collection of wait events, change the
ENABLED and TIMING columns
of the relevant instruments. For example:
mysql>UPDATE setup_instruments SET ENABLED = 'YES', TIMED = 'YES'WHERE NAME LIKE 'wait/io/socket/sql/%';
The setup_consumers table contains
consumer values with names corresponding to the current and
recent wait event table names. These consumers may be used to
filter collection of wait events. The wait consumers are
disabled by default:
mysql> SELECT * FROM setup_consumers WHERE NAME LIKE '%waits%';
+---------------------------+---------+
| NAME | ENABLED |
+---------------------------+---------+
| events_waits_current | NO |
| events_waits_history | NO |
| events_waits_history_long | NO |
+---------------------------+---------+
To enable all wait consumers, do this:
mysql>UPDATE setup_consumers SET ENABLED = 'YES'WHERE NAME LIKE '%waits%';
The setup_timers table contains a
row with a NAME value of
wait that indicates the unit for wait event
timing. The default unit is CYCLE.
mysql> SELECT * FROM setup_timers WHERE NAME = 'wait';
+------+------------+
| NAME | TIMER_NAME |
+------+------------+
| wait | CYCLE |
+------+------------+
To change the timing unit, modify the
TIMER_NAME value:
mysql>UPDATE setup_timers SET TIMER_NAME = 'NANOSECOND'WHERE NAME = 'wait';
For additional information about configuring event collection, see Section 22.3, “Performance Schema Runtime Configuration”.