events_transactions_history_long 详解

Posted by 道行尚浅 on August 24, 2021

系统表介绍

events_transactions_history_long 表包含历史事务事件

为每个线程保存的历史事务事件行数受参数 performance_schema_events_transactions_history_long_size 影响

列名 含义
THREAD_ID 线程编号
EVENT_ID 事件编号
END_EVENT_ID 结束事件ID 当事件结束后,发生启动修改线程当前事件号时置为空
EVENT_NAME 事件名称
STATE 当前事务状态
TRX_ID 事务ID(未使用)
GTID 下一个全局编号
XID_FORMAT_ID 分布式事务编号格式
XID_GTRID 分布式全局事务编号
XID_BQUAL 分布式分值编号
XA_STATE 分布式状态
SOURCE 监测器代码所在原文件
TIMER_START 事件启动的时间
TIMER_END 事件结束的时间
TIMER_WAIT 事件持续时长
ACCESS_MODE 事务访问模式(读写、只读)
ISOLATION_LEVEL 事务隔离级别
AUTOCOMMIT 是否开启自动提交
NUMBER_OF_SAVEPOINTS savepoint语句被使用的次数
NUMBER_OF_ROLLBACK_TO_SAVEPOINT ROLLBACK TO SAVEPOINT 语句被使用的次数
NUMBER_OF_RELEASE_SAVEPOINT RELEASE SAVEPOINT语句被使用的次数
OBJECT_INSTANCE_BEGIN 未使用
NESTING_EVENT_ID 嵌套事件ID
NESTING_EVENT_TYPE 嵌套事务类型

实例


mysql> select * from events_transactions_history_long ;
+-----------+----------+--------------+-------------+-------------+-----------------+-----------+---------------+-----------+-----------+----------+--------+----------------------+----------------------+-----------------+-------------+-----------------+------------+----------------------+---------------------------------+-----------------------------+-----------------------+------------------+--------------------+
| THREAD_ID | EVENT_ID | END_EVENT_ID | EVENT_NAME  | STATE       | TRX_ID          | GTID      | XID_FORMAT_ID | XID_GTRID | XID_BQUAL | XA_STATE | SOURCE | TIMER_START          | TIMER_END            | TIMER_WAIT      | ACCESS_MODE | ISOLATION_LEVEL | AUTOCOMMIT | NUMBER_OF_SAVEPOINTS | NUMBER_OF_ROLLBACK_TO_SAVEPOINT | NUMBER_OF_RELEASE_SAVEPOINT | OBJECT_INSTANCE_BEGIN | NESTING_EVENT_ID | NESTING_EVENT_TYPE |
+-----------+----------+--------------+-------------+-------------+-----------------+-----------+---------------+-----------+-----------+----------+--------+----------------------+----------------------+-----------------+-------------+-----------------+------------+----------------------+---------------------------------+-----------------------------+-----------------------+------------------+--------------------+
|       367 |      385 |          598 | transaction | ROLLED BACK | 421866089981776 | AUTOMATIC |          NULL | NULL      | NULL      | NULL     |        | 12470124137093478000 | 12470856652777979000 | 732515684501000 | READ WRITE  | REPEATABLE READ | NO         |                    0 |                               0 |                           0 |                  NULL |              362 | STATEMENT          |
+-----------+----------+--------------+-------------+-------------+-----------------+-----------+---------------+-----------+-----------+----------+--------+----------------------+----------------------+-----------------+-------------+-----------------+------------+----------------------+---------------------------------+-----------------------------+-----------------------+------------------+--------------------+
1 row in set (0.01 sec)



mysql>  show variables like 'performance_schema_events_transactions_history_long_size';
+----------------------------------------------------------+-------+
| Variable_name                                            | Value |
+----------------------------------------------------------+-------+
| performance_schema_events_transactions_history_long_size | 10000 |
+----------------------------------------------------------+-------+
1 row in set (0.00 sec)