mysql show open tables相關知識體系之一

wisdomone1發表於2019-11-30

前言

    資料庫技術博大精深,包羅永珍。涉列的知識體系非常多。mysql有個命令show open tables。本文主要梳理相關的知識點,希望通過一系列小小的總結,對於mysql初學者及進階者有所幫助。

聯絡方式

  • 微信公眾號

  • 微信

培訓課件

(收費20元已共享到百度雲盤方便同學們獲取)

mysql show open tables相關知識體系之一

mysql show open tables相關知識體系之一

目錄

  • 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可以快速判斷哪些表產生了共享讀的表鎖,以此為基礎,可以判斷其它的一些相關的鎖資料庫故障


mysql show open tables相關知識體系之一

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-2666360/,如需轉載,請註明出處,否則將追究法律責任。