What are the costs to be considered when a transaction has to be rolled back when recovering from deadlock?
Ans: A few transaction will must rolled back (made a victim) to break deadlock.
Choose that transaction as victim which will incur minimum cost.
- Rollback - find out how far to roll back transaction.
- Total rollback: Abort the transaction and after that restart it.
- More efficient to roll back transaction only as far as essential to break deadlock.
- Starvation occurs if same transaction is always selected as victim. Include the number of rollbacks in the cost factor to prevent starvation.