mysql show open tables相关知识体系之一

来源:这里教程网 时间:2026-03-01 14:46:26 作者:

前言

    数据库技术博大精深,包罗万象。涉列的知识体系非常多。mysql有个命令show open tables。本文主要梳理相关的知识点,希望通过一系列小小的总结,对于mysql初学者及进阶者有所帮助。

联系方式

微信公众号

微信

培训课件

(收费20元已共享到百度云盘方便同学们获取)

目录

show open tables概念

show open tables相关知识

show open tables示例

show open tables输出结果

补充事项

show open tables概念

show open tables相关知识

table cache 官方手册

handler...open及handler...close 官方手册

show open tables示例

mysql> show open tables from zxydb like 't_table_innodb%';
+----------+----------------+--------+-------------+
| Database | Table          | In_use | Name_locked |
+----------+----------------+--------+-------------+
| zxydb    | t_table_innodb |      0 |           0 |
+----------+----------------+--------+-------------+
1 row in set (0.00 sec)

show open tables输出结果

in_use测试示例注:unlock tables会减少in_use       lock tables write由于产生排它写锁只能用于一个线程,故其in_use至多为1

补充事项

如果没有操作表的权限,show open tables输出结果不包括此操作表

小结

根据show open tables可以快速判断哪些表产生了共享读的表锁,以此为基础,可以判断其它的一些相关的锁数据库故障

相关推荐