Performance Schema events_statements_history Table

The events_statements_history table by default contains the ten most recent completed statement events per thread. This number can be adjusted by setting the performance_schema_events_statements_history_size system variable when the server starts up.

The table structure is identical to the events_statements_current table structure, and contains the following columns:

The table contains the following columns:

ColumnDescription
THREAD_IDThread associated with the event. Together with EVENT_ID uniquely identifies the row.
EVENT_IDThread's current event number at the start of the event. Together with THREAD_ID uniquely identifies the row.
END_EVENT_IDNULL when the event starts, set to the thread's current event number at the end of the event.
EVENT_NAMEEvent instrument name and a NAME from the setup_instruments table
SOURCEName and line number of the source file containing the instrumented code that produced the event.
TIMER_STARTValue in picoseconds when the event timing started or NULL if timing is not collected.
TIMER_ENDValue in picoseconds when the event timing ended, or NULL if timing is not collected.
TIMER_WAITValue in picoseconds of the event's duration or NULL if timing is not collected.
LOCK_TIMETime in picoseconds spent waiting for locks. The time is calculated in microseconds but stored in picoseconds for compatibility with other timings.
SQL_TEXTThe SQL statement, or NULL if the command is not associated with an SQL statement.
DIGESTStatement digest.
DIGEST_TEXTStatement digest text.
CURRENT_SCHEMAStatement's default database for the statement, or NULL if there was none.
OBJECT_SCHEMAReserved, currently NULL
OBJECT_NAMEReserved, currently NULL
OBJECT_TYPEReserved, currently NULL
OBJECT_INSTANCE_BEGINAddress in memory of the statement object.
MYSQL_ERRNOError code. See MariaDB Error Codes for a full list.
RETURNED_SQLSTATEThe SQLSTATE value.
MESSAGE_TEXTStatement error message. See MariaDB Error Codes.
ERRORS0 if SQLSTATE signifies completion (starting with 00) or warning (01), otherwise 1.
WARNINGSNumber of warnings from the diagnostics area.
ROWS_AFFECTEDNumber of rows affected the statement affected.
ROWS_SENTNumber of rows returned.
ROWS_EXAMINEDNumber of rows read during the statement's execution.
CREATED_TMP_DISK_TABLESNumber of on-disk temp tables created by the statement.
CREATED_TMP_TABLESNumber of temp tables created by the statement.
SELECT_FULL_JOINNumber of joins performed by the statement which did not use an index.
SELECT_FULL_RANGE_JOINNumber of joins performed by the statement which used a range search of the first table.
SELECT_RANGENumber of joins performed by the statement which used a range of the first table.
SELECT_RANGE_CHECKNumber of joins without keys performed by the statement that check for key usage after each row.
SELECT_SCANNumber of joins performed by the statement which used a full scan of the first table.
SORT_MERGE_PASSESNumber of merge passes by the sort algorithm performed by the statement. If too high, you may need to increase the sort_buffer_size.
SORT_RANGENumber of sorts performed by the statement which used a range.
SORT_ROWSNumber of rows sorted by the statement.
SORT_SCANNumber of sorts performed by the statement which used a full table scan.
NO_INDEX_USED0 if the statement performed a table scan with an index, 1 if without an index.
NO_GOOD_INDEX_USED0 if a good index was found for the statement, 1 if no good index was found. See the Range checked for each record description in the EXPLAIN article.
NESTING_EVENT_IDReserved, currently NULL.
NESTING_EVENT_TYPEReserved, currently NULL.

It is possible to empty this table with a TRUNCATE TABLE statement.

events_statements_current and events_statements_history_long are related tables.

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.