Why is an IX-lock compatible with another IX-lock in InnoDB?

后端 未结 2 1602
猫巷女王i
猫巷女王i 2021-02-06 07:51

According to innodb lock mode lock type compatibility matrix

    X           IX          S           IS
X   Conflict    Conflict    Conflict    Conflict         


        
2条回答
  •  生来不讨喜
    2021-02-06 08:34

    IS and IX locks allow access by multiple clients. They won't necessarily conflict until they try to get real locks on the same rows.

    But a table lock (ALTER TABLE, DROP TABLE, LOCK TABLES) blocks both IS and IX, and vice-versa.

    Therefore the IX-lock compatible with another IX-lock (they both are table level) or IX-lock conflict with another X-lock(table level not row level)

    Reference: http://www.slideshare.net/billkarwin/innodb-locking-explained-with-stick-figures

提交回复
热议问题