Skip to main content
added 93 characters in body
Source Link
Paul White
  • 90.3k
  • 30
  • 424
  • 663

ypercubeᵀᴹ: When you delete a row you need to delete the reference to the row in all secondary indexes. Both transactions want to delete the row with name = 'lg4xdzvn2bth'name = 'lg4xdzvn2bth' and age=99age=99. 

Tran 2 was second to request that so it was waiting. But now Tran 1 wants to delete all the rows with name = 'lg4xdzvn2bth'name = 'lg4xdzvn2bth' as well, which tran 2 has already locks on. 

So they are both waiting on each other locks. Deadlock.

ypercubeᵀᴹ: Both transactions want to delete the row with name = 'lg4xdzvn2bth' and age=99. Tran 2 was second to request that so it was waiting. But now Tran 1 wants to delete all the rows with name = 'lg4xdzvn2bth' as well which tran 2 has already locks on. So they are both waiting on each other locks. Deadlock.

ypercubeᵀᴹ: When you delete a row you need to delete the reference to the row in all secondary indexes. Both transactions want to delete the row with name = 'lg4xdzvn2bth' and age=99. 

Tran 2 was second to request that so it was waiting. But now Tran 1 wants to delete all the rows with name = 'lg4xdzvn2bth' as well, which tran 2 has already locks on. 

So they are both waiting on each other locks. Deadlock.

Source Link
mustaccio
  • 26.9k
  • 24
  • 58
  • 74

ypercubeᵀᴹ: Both transactions want to delete the row with name = 'lg4xdzvn2bth' and age=99. Tran 2 was second to request that so it was waiting. But now Tran 1 wants to delete all the rows with name = 'lg4xdzvn2bth' as well which tran 2 has already locks on. So they are both waiting on each other locks. Deadlock.

Post Made Community Wiki by mustaccio