What is the difference of the following two sql:
select * from user where id = 1 for share
select * from user where id = 1 lock in share mode
Are they have the same effect that lock a row with shared lock?
CodePudding user response:
https://dev.mysql.com/doc/refman/8.0/en/select.html
FOR SHAREandLOCK IN SHARE MODEset shared locks that permit other transactions to read the examined rows but not to update or delete them.FOR SHAREandLOCK IN SHARE MODEare equivalent. However,FOR SHARE, likeFOR UPDATE, supportsNOWAIT,SKIP LOCKED, andOF tbl_nameoptions.FOR SHAREis a replacement forLOCK IN SHARE MODE, butLOCK IN SHARE MODEremains available for backward compatibility.
