Description\n-----------\n\nInnoDB supports row-level locking. Selected rows can be locked using LOCK IN SHARE MODE or FOR UPDATE. In both cases, a lock is acquired on the rows read by the query, and it will be released when the current transaction is committed.\n\nWhen LOCK IN SHARE MODE is specified in a SELECT statement, MariaDB will wait until all transactions that have modified the rows are committed. Then, a read lock is acquired. All transactions can read the rows, but if they want to modify them, they have to wait until your transaction is committed.\n\nInnoDB locks index records rather than logical rows. If a SELECT is satisfied by a secondary index (a covering index read), it just locks that index. Instead, the primary key records will be locked if a concurrent UPDATE modifies columns outside of that index. These locks do not overlap under READ COMMITTED isolation level, so the update can proceed. To ensure a block is used, the SELECT query must reference columns from the primary index.\n\nFor further information and an example, see InnoDB Lock Modes.\n\nIf autocommit is set to 1 (the default), the LOCK IN SHARE MODE and FOR UPDATE clauses have no effect in InnoDB. For non-transactional storage engines like MyISAM and ARIA, a table level lock will be taken even if autocommit is set to 1.\n\nURL: https://mariadb.com/docs/server/reference/sql-statements/data-manipulation/selecting-data/lock-in-share-mode