MySQL 5.7 Reference Manual Including MySQL NDB Cluster 7.5 and NDB Cluster 7.6

25.12.14 Performance Schema Status Variable Tables

Note

The value of the show_compatibility_56 system variable affects the information available from the tables described here. For details, see the description of that variable in Section 5.1.7, “Server System Variables”.

The MySQL server maintains many status variables that provide information about its operation (see Section 5.1.9, “Server Status Variables”). Status variable information is available in these Performance Schema tables:

There are also summary tables that provide status variable information aggregated by account, host name, and user name. See Section 25.12.15.10, “Status Variable Summary Tables”.

The session variable tables (session_status, status_by_thread) contain information only for active sessions, not terminated sessions.

The Performance Schema collects statistics for global status variables only for threads for which the INSTRUMENTED value is YES in the threads table. Statistics for session status variables are always collected, regardless of the INSTRUMENTED value.

The Performance Schema does not collect statistics for Com_xxx status variables in the status variable tables. To obtain global and per-session statement execution counts, use the events_statements_summary_global_by_event_name and events_statements_summary_by_thread_by_event_name tables, respectively. For example:

SELECT EVENT_NAME, COUNT_STAR
FROM performance_schema.events_statements_summary_global_by_event_name
WHERE EVENT_NAME LIKE 'statement/sql/%';

The global_status and session_status tables have these columns:

The status_by_thread table contains the status of each active thread. It has these columns:

The status_by_thread table contains status variable information only about foreground threads. If the performance_schema_max_thread_instances system variable is not autoscaled (signified by a value of −1) and the maximum permitted number of instrumented thread objects is not greater than the number of background threads, the table will be empty.

The Performance Schema supports TRUNCATE TABLE for status variable tables as follows:

FLUSH STATUS adds the session status from all active sessions to the global status variables, resets the status of all active sessions, and resets account, host, and user status values aggregated from disconnected sessions.