Skip to main content
2 of 7
added 650 characters in body
RolandoMySQLDBA
  • 184.3k
  • 33
  • 323
  • 531

To some extent, yes.

When it comes to InnoDB, you can choose what rows can get locked. It is not so much a particular setting for the DB Connection. It is a specific query you have to call before doing UPDATEs.

  • SELECT ... FOR UPDATE
  • SELECT ... LOCK IN SHARE MODE

This can initiate exclusive or shared row locks based on the result set of those SELECTs.

You can find more on this in the MySQL Documentation.

I wrote easrlier posts on using these:

With regard to sessions and connections

  • Performing SELECT ... FOR UPDATE will initiate locks on rows you intend to update and still permit other DB Connections to read.
  • Performing SELECT ... LOCK IN SHARE MODE essentially does the reverse
  • lock rows for you to read
  • prevent connections from doing SELECT ... FOR UPDATE
  • allow SELECTs of the same locked rows
RolandoMySQLDBA
  • 184.3k
  • 33
  • 323
  • 531