<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="innodb-information-schema-understanding-innodb-locking">
      </a>
      17.15.2.2 InnoDB Lock and Lock-Wait Information
     </h4>
    </div>
   </div>
  </div>
  <p>
   When a transaction updates a row in a table, or locks it with
   <code class="literal">
    SELECT FOR UPDATE
   </code>
   ,
   <code class="literal">
    InnoDB
   </code>
   establishes a list or queue of locks on that row. Similarly,
   <code class="literal">
    InnoDB
   </code>
   maintains a list of locks on a table
        for table-level locks. If a second transaction wants to update a
        row or lock a table already locked by a prior transaction in an
        incompatible mode,
   <code class="literal">
    InnoDB
   </code>
   adds a lock request
        for the row to the corresponding queue. For a lock to be
        acquired by a transaction, all incompatible lock requests
        previously entered into the lock queue for that row or table
        must be removed (which occurs when the transactions holding or
        requesting those locks either commit or roll back).
  </p>
  <p>
   A transaction may have any number of lock requests for different
        rows or tables. At any given time, a transaction may request a
        lock that is held by another transaction, in which case it is
        blocked by that other transaction. The requesting transaction
        must wait for the transaction that holds the blocking lock to
        commit or roll back. If a transaction is not waiting for a lock,
        it is in a
   <code class="literal">
    RUNNING
   </code>
   state. If a transaction is
        waiting for a lock, it is in a
   <code class="literal">
    LOCK WAIT
   </code>
   state. (The
   <code class="literal">
    INFORMATION_SCHEMA
   </code>
   <a class="link" href="information-schema-innodb-trx-table.html" title="28.4.28 The INFORMATION_SCHEMA INNODB_TRX Table">
    <code class="literal">
     INNODB_TRX
    </code>
   </a>
   table indicates
        transaction state values.)
  </p>
  <p>
   The Performance Schema
   <a class="link" href="performance-schema-data-locks-table.html" title="29.12.13.1 The data_locks Table">
    <code class="literal">
     data_locks
    </code>
   </a>
   table holds one or more rows for each
   <code class="literal">
    LOCK
        WAIT
   </code>
   transaction, indicating any lock requests that
        prevent its progress. This table also contains one row
        describing each lock in a queue of locks pending for a given row
        or table. The Performance Schema
   <a class="link" href="performance-schema-data-lock-waits-table.html" title="29.12.13.2 The data_lock_waits Table">
    <code class="literal">
     data_lock_waits
    </code>
   </a>
   table shows which
        locks already held by a transaction are blocking locks requested
        by other transactions.
  </p>
 </div>
 <br/>
</div>
