The events_statements_current Table
The events_statements_current table contains current statement events, one row per thread showing the current status of the thread's most recent monitored statement event.
The events-statements-current table can be truncated with TRUNCATE TABLE.
Of the tables that contain statement event rows, events_statements_current is the most fundamental. Other tables that contain statement event rows are logically derived from the current events. For example, the events_statements_history and events_statements_history_long tables are collections of the most recent statement events, up to a fixed number of rows.
The events_statements_current table has these columns:
THREAD_IDThe thread associated with the event. The
THREAD_IDandEVENT_IDvalues taken together form a primary key that uniquely identifies the row. No two rows will have the same pair of values.EVENT_IDThe thread current event number when the event starts.
END_EVENT_IDThis column is set to
NULLwhen the event starts, and updated to the thread current event number when the event ends. This column was added in MariaDB 5.6.4.EVENT_NAMEThe name of the instrument from which the event was collected. This is a
setup_instruments.NAMEvalue. Instrument names have multiple parts and form a hierarchy, as discussed in , "Performance Schema Instrument Naming Conventions".For SQL statements, the
EVENT_NAMEvalue initially isstatement/com/Queryuntil the statement is parsed, then changes to a more appropriate value, as described in , "Performance Schema Statement Event Tables".SOURCEThe name of the source file containing the instrumented code that produced the event and the line number in the file at which the instrumentation occurs. This enables you to check the source to determine exactly what code is involved.
TIMER_START,TIMER_END,TIMER_WAITTiming information for the event. The unit for these values is picoseconds (trillionths of a second). The
TIMER_STARTandTIMER_ENDvalues indicate when event timing started and ended.TIMER_WAITis the event elapsed time (duration).If an event has not finished,
TIMER_ENDandTIMER_WAITareNULL.If an event is produced from an instrument that has
TIMED = NO, timing information is not collected, andTIMER_START,TIMER_END, andTIMER_WAITare allNULL.For discussion of picoseconds as the unit for event times and factors that affect time values, see , "Performance Schema Event Timing".
LOCK_TIMEThe time spent waiting for table locks. This value is computed in microseconds but normalized to picoseconds for easier comparison with other Performance Schema timers.
SQL_TEXTThe text of the SQL statement. For a command not associated with a SQL statement, the value is
NULL.CURRENT_SCHEMAThe default database for the statement,
NULLif there is none.OBJECT_SCHEMA,OBJECT_NAME,OBJECT_TYPEReserved. Currently
NULL.OBJECT_INSTANCE_BEGINThis column identifies the statement. The value is the address of an object in memory.
MYSQL_ERRNOThe statement error number, from the statement diagnostics area.
RETURNED_SQLSTATEThe statement SQLSTATE value, from the statement diagnostics area.
MESSAGE_TEXTThe statement error message, from the statement diagnostics area.
ERRORSWhether an error occurred for the statement. The value is 0 if the SQLSTATE value begins with
00(completion) or01(warning). The value is 1 is the SQLSTATE value is anything else.WARNINGSThe number of warnings, from the statement diagnostics area.
ROWS_AFFECTEDThe number of rows affected by the statement. For a description of the meaning of "affected," see , "
mysql_affected_rows()".ROWS_SENTThe number of rows returned by the statement.
ROWS_EXAMINEDThe number of rows read from storage engines during statement execution.
CREATED_TMP_DISK_TABLESLike the
Created_tmp_disk_tablesstatus variable, but specific to the statement.CREATED_TMP_TABLESLike the
Created_tmp_tablesstatus variable, but specific to the statement.SELECT_FULL_JOINLike the
Select_full_joinstatus variable, but specific to the statement.SELECT_FULL_RANGE_JOINLike the
Select_full_range_joinstatus variable, but specific to the statement.SELECT_RANGELike the
Select_rangestatus variable, but specific to the statement.SELECT_RANGE_CHECKLike the
Select_range_checkstatus variable, but specific to the statement.SELECT_SCANLike the
Select_scanstatus variable, but specific to the statement.SORT_MERGE_PASSESLike the
Sort_merge_passesstatus variable, but specific to the statement.SORT_RANGELike the
Sort_rangestatus variable, but specific to the statement.SORT_ROWSLike the
Sort_rowsstatus variable, but specific to the statement.SORT_SCANLike the
Sort_scanstatus variable, but specific to the statement.NO_INDEX_USED1 if the statement performed a table scan without using an index, 0 otherwise.
NO_GOOD_INDEX_USED1 if the server found no good index to use for the statement, 0 otherwise. For additional information, see the description of the
Extracolumn fromEXPLAINoutput for theRange checked for each recordvalue in , "EXPLAINOutput Format".NESTING_EVENT_ID,NESTING_EVENT_TYPEReserved. Currently
NULL.
The events_statements_current table was added in MariaDB 5.6.3.