Documentation Home
MySQL 5.7 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 35.6Mb
PDF (A4) - 35.6Mb
PDF (RPM) - 34.7Mb
EPUB - 8.7Mb
HTML Download (TGZ) - 8.5Mb
HTML Download (Zip) - 8.5Mb
HTML Download (RPM) - 7.3Mb
Eclipse Doc Plugin (TGZ) - 9.4Mb
Eclipse Doc Plugin (Zip) - 11.5Mb
Man Pages (TGZ) - 203.5Kb
Man Pages (Zip) - 310.2Kb
Info (Gzip) - 3.3Mb
Info (Zip) - 3.3Mb
Excerpts from this Manual

23.9.7.1 The events_transactions_current Table

The events_transactions_current table (added in MySQL 5.7.3) contains current transaction events, one row per thread showing the current status of the thread's most recent monitored transaction event. For example:

mysql> SELECT * FROM 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: 0
NUMBER_OF_ROLLBACK_TO_SAVEPOINT: 0
    NUMBER_OF_RELEASE_SAVEPOINT: 0
          OBJECT_INSTANCE_BEGIN: NULL
               NESTING_EVENT_ID: 6
             NESTING_EVENT_TYPE: STATEMENT

The events_transactions_current table can be truncated with TRUNCATE TABLE.

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, the events_transactions_history and events_transactions_history_long tables are collections of the most recent transaction events, up to a fixed number of rows.

For information about configuration of transaction event collection, see Section 23.9.7, “Performance Schema Transaction Tables”.

The events_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. The THREAD_ID and EVENT_ID values taken together uniquely identify the row. No two rows have the same pair of values.

  • END_EVENT_ID

    This column is set to NULL 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 a NAME value from the setup_instruments table. Instrument names may have multiple parts and form a hierarchy, as discussed in Section 23.4, “Performance Schema Instrument Naming Conventions”.

  • STATE

    The current transaction state. The value is ACTIVE (after START TRANSACTION or BEGIN), COMMITTED (after COMMIT), or ROLLED BACK (after ROLLBACK).

  • TRX_ID

    Unused.

  • GTID

    This column changed in MySQL 5.7.6.

    • Versions of MySQL prior to 5.7.6:

      If gtid_mode=OFF, the value is NULL. If gtid_mode=ON, this is the value of gtid_next when the transaction started. If gtid_next=AUTOMATIC the value is AUTOMATIC, otherwise the value is a GTID in UUID:NUMBER format.

    • Versions of MySQL 5.7.6 and later:

      The GTID column contains the value of gtid_next, which can be one of ANONYMOUS, AUTOMATIC, or a GTID using the format UUID:NUMBER. For transactions that use gtid_next=AUTOMATIC, which is all normal client transactions, the GTID column changes when the transaction commits and the actual GTID is assigned. If gtid_mode is either ON or ON_PERMISSIVE, the GTID column changes to the transaction's GTID. If gtid_mode is either OFF or OFF_PERMISSIVE, the GTID column changes to ANONYMOUS.

  • XID

    The XA transaction identifier. It has the format described in Section 14.3.7.1, “XA Transaction SQL Syntax”. This column was removed in MySQL 5.7.7 and replaced with the XID_FORMAT_ID, XID_GTRID, and XID_BQUAL columns representing the components of XID values.

  • XID_FORMAT_ID, XID_GTRID, and XID_BQUAL

    The components of the XA transaction identifier. They have the format described in Section 14.3.7.1, “XA Transaction SQL Syntax”. These columns were added in MySQL 5.7.7 as replacements for the XID column.

  • XA_STATE

    The state of the XA transaction. The value is ACTIVE (after XA START), IDLE (after XA END), PREPARED (after XA PREPARE), ROLLED BACK (after XA ROLLBACK), or COMMITTED (after XA COMMIT).

  • 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). The TIMER_START and TIMER_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 and TIMER_WAIT are NULL before MySQL 5.7.8. As of 5.7.8, TIMER_END is the current timer value and TIMER_WAIT is the time elapsed so far (TIMER_ENDTIMER_START).

    If an event is produced from an instrument that has TIMED = NO, timing information is not collected, and TIMER_START, TIMER_END, and TIMER_WAIT are all NULL.

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

  • ACCESS_MODE

    The transaction access mode. The value is READ ONLY or READ WRITE.

  • ISOLATION_LEVEL

    The transaction isolation level. The value is REPEATABLE READ, READ COMMITTED, READ UNCOMMITTED, or SERIALIZABLE.

  • AUTOCOMMIT

    Whether autcommit mode was enabled when the transaction started.

  • NUMBER_OF_SAVEPOINTS, NUMBER_OF_ROLLBACK_TO_SAVEPOINT, NUMBER_OF_RELEASE_SAVEPOINT

    The number of SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT statements issued during the transaction.

  • OBJECT_INSTANCE_BEGIN

    Unused.

  • NESTING_EVENT_ID

    The EVENT_ID value of the event within which this event is nested.

  • NESTING_EVENT_TYPE

    The nesting event type. The value is TRANSACTION, STATEMENT, STAGE, or WAIT. (TRANSACTION will not appear because transactions cannot be nested.)


User Comments
Sign Up Login You must be logged in to post a comment.