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: 

• VARIABLE_NAME 

The status variable name. 

• VARIABLE_VALUE 

The status variable value. For global_status , this column contains the global value. For session_status , this column contains the variable value for the current session. 

The global_status  and session_status  tables have these indexes: 

•Primary key on ( VARIABLE_NAME ) 

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

• THREAD_ID 

The thread identifier of the session in which the status variable is defined. 

• VARIABLE_NAME 

The status variable name. 

• VARIABLE_VALUE 

The session variable value for the session named by the THREAD_ID  column. 

The status_by_thread  table has these indexes: 

•Primary key on ( THREAD_ID , VARIABLE_NAME ) 

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 is empty. 

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

• global_status : Resets thread, account, host, and user status. Resets global status variables except those that the server never resets. 

