• <bdo id='qGqeb'></bdo><ul id='qGqeb'></ul>

        <legend id='qGqeb'><style id='qGqeb'><dir id='qGqeb'><q id='qGqeb'></q></dir></style></legend>

        <small id='qGqeb'></small><noframes id='qGqeb'>

        <i id='qGqeb'><tr id='qGqeb'><dt id='qGqeb'><q id='qGqeb'><span id='qGqeb'><b id='qGqeb'><form id='qGqeb'><ins id='qGqeb'></ins><ul id='qGqeb'></ul><sub id='qGqeb'></sub></form><legend id='qGqeb'></legend><bdo id='qGqeb'><pre id='qGqeb'><center id='qGqeb'></center></pre></bdo></b><th id='qGqeb'></th></span></q></dt></tr></i><div id='qGqeb'><tfoot id='qGqeb'></tfoot><dl id='qGqeb'><fieldset id='qGqeb'></fieldset></dl></div>

        <tfoot id='qGqeb'></tfoot>
      1. 如何找到导致“等待表元数据锁定"的事务?状态?

        时间:2023-06-03

          <i id='Ira5L'><tr id='Ira5L'><dt id='Ira5L'><q id='Ira5L'><span id='Ira5L'><b id='Ira5L'><form id='Ira5L'><ins id='Ira5L'></ins><ul id='Ira5L'></ul><sub id='Ira5L'></sub></form><legend id='Ira5L'></legend><bdo id='Ira5L'><pre id='Ira5L'><center id='Ira5L'></center></pre></bdo></b><th id='Ira5L'></th></span></q></dt></tr></i><div id='Ira5L'><tfoot id='Ira5L'></tfoot><dl id='Ira5L'><fieldset id='Ira5L'></fieldset></dl></div>
            • <legend id='Ira5L'><style id='Ira5L'><dir id='Ira5L'><q id='Ira5L'></q></dir></style></legend>

                <tbody id='Ira5L'></tbody>

                <small id='Ira5L'></small><noframes id='Ira5L'>

              1. <tfoot id='Ira5L'></tfoot>
                • <bdo id='Ira5L'></bdo><ul id='Ira5L'></ul>
                • 本文介绍了如何找到导致“等待表元数据锁定"的事务?状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试对表执行一些 DDL,并且 SHOW PROCESSLIST 导致等待表元数据锁定"消息.

                  I am trying to perform some DDL on a table and SHOW PROCESSLIST results in a " Waiting for table metadata lock " message.

                  我如何知道哪些交易尚未完成?

                  How can I find out which transaction is not yet closed?

                  我使用的是 MySQL v5.5.24.

                  I'm using MySQL v5.5.24.

                  推荐答案

                  适用于 MySql 版本 <5.7.3

                  SHOW ENGINE INNODB STATUS \G
                  

                  寻找部分-

                  TRANSACTIONS
                  

                  我们可以使用INFORMATION_SCHEMA表格.

                  We can use INFORMATION_SCHEMA Tables.

                  有用的查询

                  要检查所有的锁事务正在等待:

                  To check about all the locks transactions are waiting for:

                  USE INFORMATION_SCHEMA;
                  SELECT * FROM INNODB_LOCK_WAITS;
                  

                  阻止交易的列表:

                  SELECT * 
                  FROM INNODB_LOCKS 
                  WHERE LOCK_TRX_ID IN (SELECT BLOCKING_TRX_ID FROM INNODB_LOCK_WAITS);
                  

                  SELECT INNODB_LOCKS.* 
                  FROM INNODB_LOCKS
                  JOIN INNODB_LOCK_WAITS
                    ON (INNODB_LOCKS.LOCK_TRX_ID = INNODB_LOCK_WAITS.BLOCKING_TRX_ID);
                  

                  特定表上的锁列表:

                  A List of locks on particular table:

                  SELECT * FROM INNODB_LOCKS 
                  WHERE LOCK_TABLE = db_name.table_name;
                  

                  等待锁定的事务列表:

                  A list of transactions waiting for locks:

                  SELECT TRX_ID, TRX_REQUESTED_LOCK_ID, TRX_MYSQL_THREAD_ID, TRX_QUERY
                  FROM INNODB_TRX
                  WHERE TRX_STATE = 'LOCK WAIT';
                  

                  参考 - MySQL 故障排除:当查询不起作用时该怎么办,第 6 章 - 第 96 页.

                  Reference - MySQL Troubleshooting: What To Do When Queries Don't Work, Chapter 6 - Page 96.

                  这篇关于如何找到导致“等待表元数据锁定"的事务?状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:MySQL 分片方法? 下一篇:如何围绕现有数据库构建烧瓶应用程序?

                  相关文章

                  • <bdo id='3W3JQ'></bdo><ul id='3W3JQ'></ul>

                  <small id='3W3JQ'></small><noframes id='3W3JQ'>

                  <i id='3W3JQ'><tr id='3W3JQ'><dt id='3W3JQ'><q id='3W3JQ'><span id='3W3JQ'><b id='3W3JQ'><form id='3W3JQ'><ins id='3W3JQ'></ins><ul id='3W3JQ'></ul><sub id='3W3JQ'></sub></form><legend id='3W3JQ'></legend><bdo id='3W3JQ'><pre id='3W3JQ'><center id='3W3JQ'></center></pre></bdo></b><th id='3W3JQ'></th></span></q></dt></tr></i><div id='3W3JQ'><tfoot id='3W3JQ'></tfoot><dl id='3W3JQ'><fieldset id='3W3JQ'></fieldset></dl></div>
                  1. <legend id='3W3JQ'><style id='3W3JQ'><dir id='3W3JQ'><q id='3W3JQ'></q></dir></style></legend>
                    <tfoot id='3W3JQ'></tfoot>