In general, I would say no, this is not with well-designed code. And the reason is that the causes of dead ends and the methods to avoid / eliminate them, as a rule, do not depend on time. Most deadlocks occur due to different update paths in the threads. For example, code A updates table1, and then updates table2, and code block B updates table2, and then updates table1. Methods to prevent this are related to ensuring that different code blocks try and update elements in the same order. In other words, avoid scenarios where thread 1 has a lock on A and wants to update B, while thread 2 has a lock on B and wants to update A.
However, if existing conflicting blocks / coding operators exist, I think compound keys can increase the frequency of deadlocks. Basically, the longer the transaction takes, the more time the other thread must block another resource and cause a deadlock.
Except in the case of a very small / specific edge, I do not think that composite keys will affect the occurrence of deadlocks (at least not in my experiments).
Steven mastandrea
source share