假设有一个perl程序会去update一个表的两列。
A进程执行了这个程序,过程如下:update x -> update y -> commit
B进程执行了这个程序,过程如下:update y -> update x -> commit
于是便有可能发生死锁
问题是要给出三种以上防止的方法。
我只知道,在得到行x和y的时候使用select for update,请问还有什么其他的方法?
谢啦!
...全文
1662打赏收藏
防止mysql 死锁的方法
各位大侠,遇到一个面试题,求助~ 假设有一个perl程序会去update一个表的两列。 A进程执行了这个程序,过程如下:update x -> update y -> commit B进程执行了这个程序,过程如下:update y -> update x -> commit 于是便有可能发生死锁 问题是要给出三种以上防止的方法。 我只知道,在得到行x和y的时候使用select for update,请问还有什么其他的方法? 谢啦!