mysqllocks

Are record locks, gap locks, Next-key locks, Insert Intention Locks and AUTO-INC Locks the part of Intention Locks?


According to the documentation of MySQL all the types of the locking are the different types of locks. But all of them use FOR SHARE or FOR UPDATE instruction as the Intention Locks. So I can't understand are the record locks, gap locks, Next-key locks, Insert Intention Locks and AUTO-INC Locks the part of Intention Locks or this is the absolutely different types of locks but with the same syntax


Solution

  • No, you are mixing up intention locks with the different type of actual locks!

    As mysql documentation you linked in your question says (emphasis is mine):

    Intention locks are table-level locks that indicate which type of lock (shared or exclusive) a transaction requires later for a row in a table.

    All the other locks you listed are actual locks used when you execute insert, update or delete statements.