Extending the SYS schema to show metadata locks
Starting with MySQL 5.7, performance_schema has been enhanced to instrument metadata locks, and can be turned on by adding the following line to your my.cnf file:
performance-schema-instrument='wait/lock/metadata/sql/%=ON'
(At runtime, it can also be enabled by modifying the setup_instruments table in performance_schema.)
From here, you can now query performance_schema.metadata_locks to reveal all currently open metadata locks on your server:
mysqlselect * from performance_schema.metadata_locksG *************************** 1.