MySQL :: MySQL 8.0 Reference Manual :: 29.12.4.1 The events_waits_current Table (original) (raw)

29.12.4.1 The events_waits_current Table

The events_waits_current table contains current wait events. The table stores one row per thread showing the current status of the thread's most recent monitored wait event, so there is no system variable for configuring the table size.

Of the tables that contain wait event rows,events_waits_current is the most fundamental. Other tables that contain wait event rows are logically derived from the current events. For example, theevents_waits_history andevents_waits_history_long tables are collections of the most recent wait events that have ended, up to a maximum number of rows per thread and globally across all threads, respectively.

For more information about the relationship between the three wait event tables, seeSection 29.9, “Performance Schema Tables for Current and Historical Events”.

For information about configuring whether to collect wait events, see Section 29.12.4, “Performance Schema Wait Event Tables”.

The events_waits_current table has these columns:

SELECT ... FROM t1 JOIN t2 ON ... JOIN t3 ON ...  

Table “fanout” is the increase or decrease in number of rows from adding a table during join processing. If the fanout for table t3 is greater than 1, the majority of row-fetch operations are for that table. Suppose that the join accesses 10 rows fromt1, 20 rows from t2 per row from t1, and 30 rows fromt3 per row of tablet2. With single-row reporting, the total number of instrumented operations is:

10 + (10 * 20) + (10 * 20 * 30) = 6210  

A significant reduction in the number of instrumented operations is achievable by aggregating them per scan (that is, per unique combination of rows fromt1 and t2). With batch I/O reporting, the Performance Schema produces an event for each scan of the innermost tablet3 rather than for each row, and the number of instrumented row operations reduces to:

10 + (10 * 20) + (10 * 20) = 410  

That is a reduction of 93%, illustrating how the batch-reporting strategy significantly reduces Performance Schema overhead for table I/O by reducing the number of reporting calls. The tradeoff is lesser accuracy for event timing. Rather than time for an individual row operation as in per-row reporting, timing for batch I/O includes time spent for operations such as join buffering, aggregation, and returning rows to the client.
For batch I/O reporting to occur, these conditions must be true:

The events_waits_current table has these indexes:

TRUNCATE TABLE is permitted for the events_waits_current table. It removes the rows.