




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





Transactions can cause each other to abort forever.
T 1 starts running. Then T 2 starts running. - They deadlock and T 1 (the oldest) is aborted. - T 1 restarts, bumps into T 2 and again deadlocks - T 2 (the oldest) is aborted ... - Choosing the youngest in a cycle as victim avoidscyclic restart, since the oldest running transaction isnever the victim. - Can combine with other heuristics, e.g. fewest-locks
Aborts the transaction that is “cheapest” to rollback.
“Cheapest” is determined by the amount of loggenerated. - Allows transactions that you’ve invested a lot in tocomplete. - SET DEADLOCK_PRIORITY LOW(vs. NORMAL) causes a transaction to sacrificeitself as a victim.
The deadlock spans two nodes.Neither node alone can see it.
Uses a waits-for graph for single-serverdeadlock detection.
The transaction that detects the deadlock isthe victim. - Uses timeouts to detect distributed deadlocks.
Locking Performance
A more detailed look at multigranularitylocking - Hot spot techniques - Query-Update Techniques - Phantoms - B-Trees and Tree locking
The following is oversimplified. We’ll revisit it.
Deadlocks are rare. - Typically 1-2% of transactions deadlock. - Locking performance problems are not rare. - The problem is too much blocking. - The solution is to reduce the “locking load” - Good heuristic – If more than 30% of transactionsare blocked, then reduce the number ofconcurrent transactions