How to avoid database deadlocks?

后端 未结 2 1960
抹茶落季
抹茶落季 2021-01-13 22:19

Some database features, such as SELECT ... FOR UPDATE and ON DELETE CASCADE, are implicitly vulnerable to deadlocks because the database does not s

2条回答
  •  悲哀的现实
    2021-01-13 23:00

    A few years wiser, I am revising the accepted answer to state that database deadlocks cannot be prevented.

    If you are lucky enough to be able to break down database operations to only interact with a single table at a time (something that isn't always possible) then you are forced to choose between poor performance and the possibility of deadlocks. Pick your poison.

提交回复
热议问题