How locks (S,X,IS,IX) work in Mysql with queries like FOR UPDATE/LOCK IN SHARE MODE?

回眸只為那壹抹淺笑 提交于 2019-12-06 14:21:20

Bill Karwin answered this question through email.He said:

  1. The same transaction that holds an S lock can promote the lock to an X lock. This is not a conflict.

  2. The SELECT in session 1 with FOR UPDATE acquires an X lock. A simple SELECT query with no locking clause specified does not need to acquire an S lock.

Any UPDATE or DELETE needs to acquire an X lock. That's implicit. Those statements don't have any special locking clause for that.

For more details on IS/IX locks and FOR UPDATE/LOCK IN SHARE MODE please visit shared-and-exclusive-locks .

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!