Detecting locked tables (locked by LOCK TABLE)

前端 未结 8 1611
野趣味
野趣味 2020-11-29 18:46

Is there a way to detect locked tables in MySQL? I mean tables locked by the LOCK TABLE table WRITE/READ command.

(Note that readers interested in

相关标签:
8条回答
  • 2020-11-29 19:42

    This article describes how to get information about locked MySQL resources. mysqladmin debug might also be of some use.

    0 讨论(0)
  • 2020-11-29 19:46

    You could also get all relevant details from performance_schema:

    SELECT
    OBJECT_SCHEMA
    ,OBJECT_NAME
    ,GROUP_CONCAT(DISTINCT EXTERNAL_LOCK)
    FROM performance_schema.table_handles 
    WHERE EXTERNAL_LOCK IS NOT NULL
    
    GROUP BY
    OBJECT_SCHEMA
    ,OBJECT_NAME
    

    This works similar as

    show open tables WHERE In_use > 0
    
    0 讨论(0)
提交回复
热议问题