mysql锁分析相关的几个系统视图
1、infomation_schema.innodb_lock_waits
+-------------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+-------------+------+-----+---------+-------+
| requesting_trx_id | varchar(18) | NO | | | | #请求锁的事务id
| requested_lock_id | varchar(81) | NO | | | | #请求锁的id
| blocking_trx_id | varchar(18) | NO | | | | #拥有锁的事务id
| blocking_lock_id | varchar(81) | NO | | | | #拥有锁的id
+-------------------+-------------+------+-----+---------+-------+
创新互联-专业网站定制、快速模板网站建设、高性价比梁园网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式梁园网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖梁园地区。费用合理售后完善,10多年实体公司更值得信赖。
2、information_schema.innodb_trx
+----------------------------+---------------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default |Extra |
+----------------------------+---------------------+------+-----+---------------------+-------+
| trx_id | varchar(18) | NO | | | | # 事务id
| trx_state | varchar(13) | NO | | | | # 事务的执行状态
| trx_started | datetime | NO | | 0000-00-00 00:00:00 | | # 事务开始的时间
| trx_requested_lock_id | varchar(81) | YES | | NULL | | # 事务正等待的锁id
| trx_wait_started | datetime | YES | | NULL | | # 事务等待锁开始的时间
| trx_weight | bigint(21) unsigned | NO | | 0 | | # 事务权重,主要反映事物修改和锁定的行数
| trx_MySQL_thread_id | bigint(21) unsigned | NO | | 0 | | # 事务相应线程的id
| trx_query | varchar(1024) | YES | | NULL | | # 事务SQL语句
| trx_operation_state | varchar(64) | YES | | NULL | | # 事务的目前操作
| trx_tables_in_use | bigint(21) unsigned | NO | | 0 | | # 事务处理当前SQL所用的表数
| trx_tables_locked | bigint(21) unsigned | NO | | 0 | | # 事务当前SQL拥有行锁的表数
| trx_lock_structs | bigint(21) unsigned | NO | | 0 | | # 事物保留的锁数
| trx_lock_memory_bytes | bigint(21) unsigned | NO | | 0 | | # 事务锁结构所占内存大小
| trx_rows_locked | bigint(21) unsigned | NO | | 0 | | # 事务锁住的近似行数
| trx_rows_modified | bigint(21) unsigned | NO | | 0 | | # 事务修改和插入的行数
| trx_concurrency_tickets | bigint(21) unsigned | NO | | 0 | | # 指示当前事务被交换出之前需处理工作量的数值
| trx_isolation_level | varchar(16) | NO | | | | # 当前事务的隔离等级
| trx_unique_checks | int(1) | NO | | 0 | | # 唯一检查对当前事务是否开启
| trx_foreign_key_checks | int(1) | NO | | 0 | | # 外键检查对当前事务是否开启
| trx_last_foreign_key_error | varchar(256) | YES | | NULL | | # 最近外键报错的详细信息
| trx_adaptive_hash_latched | int(1) | NO | | 0 | | # 当前事务是否锁定自适应哈希索引
|
trx_adaptive_hash_timeout | bigint(21) unsigned | NO | | 0
| | # 指示当前事务是否放弃或保留搜索自适应索引的数值,为0时,则立即放弃
| trx_is_read_only | int(1) | NO | | 0 | | # 当前事务是否只读,1为只读
| trx_autocommit_non_locking | int(1) | NO | | 0 | | # 指示当前事务是否为非锁定自动提交
+----------------------------+---------------------+------+-----+---------------------+-------+
3、information_schema.innodb_locks
+-------------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+---------------------+------+-----+---------+-------+
| lock_id | varchar(81) | NO | | | | # 锁id
| lock_trx_id | varchar(18) | NO | | | | # 拥有锁的事务id
| lock_mode | varchar(32) | NO | | | | # 锁模式
| lock_type | varchar(32) | NO | | | | # 锁类型
| lock_table | varchar(1024) | NO | | | | # 被锁的表
| lock_index | varchar(1024) | YES | | NULL | | # 被锁的索引
| lock_space | bigint(21) unsigned | YES | | NULL | | # 被锁的表空间号
| lock_page | bigint(21) unsigned | YES | | NULL | | # 被锁的页号
| lock_rec | bigint(21) unsigned | YES | | NULL | | # 被锁的记录号
| lock_data | varchar(8192) | YES | | NULL | | # 被锁的数据
+-------------+---------------------+------+-----+---------+-------+
4、information_schema.processlist
+---------+---------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+---------------------+------+-----+---------+-------+
| ID | bigint(21) unsigned | NO | | 0 | | # 连接线程的id
| USER | varchar(32) | NO | | | | # 登录mysql的user
| HOST | varchar(64) | NO | | | | # 登录mysql的主机名或地址:端口
| DB | varchar(64) | YES | | NULL | | # 登录mysql的数据库名
| COMMAND | varchar(16) | NO | | | | # 连接线程当前运行命令的类型
| TIME | int(7) | NO | | 0 | | # 连接线程处于当前状态的秒数
| STATE | varchar(64) | YES | | NULL | | # 连接线程当前所处的状态
| INFO | longtext | YES | | NULL | | # 连接线程当前正执行的语句
+---------+---------------------+------+-----+---------+-------+
网页题目:mysql锁分析相关的几个系统视图
浏览路径:http://scyanting.com/article/igijjp.html