I am not sure about this part of the transaction manual
For locking reads (SELECT with FOR UPDATE or LOCK IN SHARE MODE), UPDATE, and DELETE statements, locking depends on whether the statement uses a unique index with a unique search condition, or a range-type search condition. For a unique index with a unique search condition, InnoDB locks only the index record found, not the gap before it.
For other search conditions, InnoDB locks the index range scanned, using gap locks or next-key (gap plus index-record) locks to block insertions by other sessions into the gaps covered by the range.
Maybe I'm just nitpicking, but I seem to read that there is a special condition in which "only the index record found" is locked (being: "unique index with unique search condition"). For all other we get some sort of range.
But what about 'other search conditions" that are nog a range? For istance, if I lock a query like
SELECT * FROM table WHERE table.col = 2, there is no range or gaps in question, even if
col is not unique, isn't there? Should we get a "only record found" lock here as well?