Documentation Home
MySQL 9.1 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.4Mb
PDF (A4) - 40.5Mb
Man Pages (TGZ) - 259.5Kb
Man Pages (Zip) - 366.7Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb


29.12.7.1 The events_transactions_current Table

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

mysql> SELECT *       FROM performance_schema.events_transactions_current LIMIT 1\G*************************** 1. row ***************************                      THREAD_ID: 26                       EVENT_ID: 7                   END_EVENT_ID: NULL                     EVENT_NAME: transaction                          STATE: ACTIVE                         TRX_ID: NULL                           GTID: 3E11FA47-71CA-11E1-9E33-C80AA9429562:56                            XID: NULL                       XA_STATE: NULL                         SOURCE: transaction.cc:150                    TIMER_START: 420833537900000                      TIMER_END: NULL                     TIMER_WAIT: NULL                    ACCESS_MODE: READ WRITE                ISOLATION_LEVEL: REPEATABLE READ                     AUTOCOMMIT: NO           NUMBER_OF_SAVEPOINTS: 0NUMBER_OF_ROLLBACK_TO_SAVEPOINT: 0    NUMBER_OF_RELEASE_SAVEPOINT: 0          OBJECT_INSTANCE_BEGIN: NULL               NESTING_EVENT_ID: 6             NESTING_EVENT_TYPE: STATEMENT

Of the tables that contain transaction event rows,events_transactions_current is the most fundamental. Other tables that contain transaction event rows are logically derived from the current events. For example, theevents_transactions_history andevents_transactions_history_long tables are collections of the most recent transaction 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 transaction event tables, seeSection 29.9, “Performance Schema Tables for Current and Historical Events”.

For information about configuring whether to collect transaction events, seeSection 29.12.7, “Performance Schema Transaction Tables”.

Theevents_transactions_current table has these columns:

  • THREAD_ID,EVENT_ID

    The thread associated with the event and the thread current event number when the event starts. TheTHREAD_ID andEVENT_ID values taken together uniquely identify the row. No two rows have the same pair of values.

  • END_EVENT_ID

    This column is set toNULL when the event starts and updated to the thread current event number when the event ends.

  • EVENT_NAME

    The name of the instrument from which the event was collected. This is aNAME value from thesetup_instruments table. Instrument names may have multiple parts and form a hierarchy, as discussed inSection 29.6, “Performance Schema Instrument Naming Conventions”.

  • STATE

    The current transaction state. The value isACTIVE (afterSTART TRANSACTION orBEGIN),COMMITTED (afterCOMMIT), orROLLED BACK (afterROLLBACK).

  • TRX_ID

    Unused.

  • GTID

    The GTID column contains the value ofgtid_next, which can be one ofANONYMOUS,AUTOMATIC, or a GTID using the formatUUID:NUMBER. For transactions that usegtid_next=AUTOMATIC, which is all normal client transactions, the GTID column changes when the transaction commits and the actual GTID is assigned. Ifgtid_mode is eitherON orON_PERMISSIVE, the GTID column changes to the transaction's GTID. Ifgtid_mode is eitherOFF orOFF_PERMISSIVE, the GTID column changes toANONYMOUS.

  • XID_FORMAT_ID,XID_GTRID, andXID_BQUAL

    The elements of the XA transaction identifier. They have the format described inSection 15.3.8.1, “XA Transaction SQL Statements”.

  • XA_STATE

    The state of the XA transaction. The value isACTIVE (afterXA START),IDLE (afterXA END),PREPARED (afterXA PREPARE),ROLLED BACK (afterXA ROLLBACK), orCOMMITTED (afterXA COMMIT).

    On a replica, the same XA transaction can appear in theevents_transactions_current table with different states on different threads. This is because immediately after the XA transaction is prepared, it is detached from the replica's applier thread, and can be committed or rolled back by any thread on the replica. Theevents_transactions_current table displays the current status of the most recent monitored transaction event on the thread, and does not update this status when the thread is idle. So the XA transaction can still be displayed in thePREPARED state for the original applier thread, after it has been processed by another thread. To positively identify XA transactions that are still in thePREPARED state and need to be recovered, use theXA RECOVER statement rather than the Performance Schema transaction tables.

  • SOURCE

    The 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_WAIT

    Timing information for the event. The unit for these values is picoseconds (trillionths of a second). TheTIMER_START andTIMER_END values indicate when event timing started and ended.TIMER_WAIT is the event elapsed time (duration).

    If an event has not finished,TIMER_END is the current timer value andTIMER_WAIT is the time elapsed so far (TIMER_ENDTIMER_START).

    If an event is produced from an instrument that hasTIMED = NO, timing information is not collected, andTIMER_START,TIMER_END, andTIMER_WAIT are allNULL.

    For discussion of picoseconds as the unit for event times and factors that affect time values, seeSection 29.4.1, “Performance Schema Event Timing”.

  • ACCESS_MODE

    The transaction access mode. The value isREAD WRITE orREAD ONLY.

  • ISOLATION_LEVEL

    The transaction isolation level. The value isREPEATABLE READ,READ COMMITTED,READ UNCOMMITTED, orSERIALIZABLE.

  • AUTOCOMMIT

    Whether autocommit mode was enabled when the transaction started.

  • NUMBER_OF_SAVEPOINTS,NUMBER_OF_ROLLBACK_TO_SAVEPOINT,NUMBER_OF_RELEASE_SAVEPOINT

    The number ofSAVEPOINT,ROLLBACK TO SAVEPOINT, andRELEASE SAVEPOINT statements issued during the transaction.

  • OBJECT_INSTANCE_BEGIN

    Unused.

  • NESTING_EVENT_ID

    TheEVENT_ID value of the event within which this event is nested.

  • NESTING_EVENT_TYPE

    The nesting event type. The value isTRANSACTION,STATEMENT,STAGE, orWAIT. (TRANSACTION does not appear because transactions cannot be nested.)

Theevents_transactions_current table has these indexes:

  • Primary key on (THREAD_ID,EVENT_ID)

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