title: Why is an IX-lock compatible with another IX-lock in InnoDB?
body: <p>According to <a href="http://dev.mysql.com/doc/refman/5.7/en/innodb-lock-modes.html" rel="nofollow noreferrer">innodb lock mode</a> <em>lock type compatibility matrix</em></p>
  <pre><code>    X           IX          S           IS
  X   Conflict    Conflict    Conflict    Conflict
  IX  Conflict    Compatible  Conflict    Compatible
  S   Conflict    Conflict    Compatible  Compatible
  IS  Conflict    Compatible  Compatible  Compatible
  </code></pre>
  <p><code>IX</code> is compatible with <code>IX</code>, but the fact is if we acquire one <code>IX</code> lock by</p>
  <blockquote>
  <p><code>select c1 from z where c1 = 1 for update</code></p>
  </blockquote>
  <p>in session 1, trying to acquire <code>IX</code> by</p>
  <blockquote>
  <p><code>select c1 from z where c1 = 1 for update</code></p>
  </blockquote>
  <p>will be blocked in session 2, so I think they are not compatible. Did I miss anything here?</p>
  <hr />
  <h3><strong>Final explanation:</strong></h3>
  <p>The reason why</p>
  <blockquote>
  <p><code>select ... for update</code></p>
  </blockquote>
  <p>in one session blocks</p>
  <blockquote>
  <p><code>select ... for update</code></p>
  </blockquote>
  <p>in another is they are asking not only <code>IX</code> lock on table level but also <code>X</code> lock on row level. It is all because of <code>X</code> lock.</p>