Making changes
You must try to understand why deadlock occurred so that you can choose the right action to solve the deadlock.
About this task
In general, a deadlock occurs because two or more transactions both want the same resources in opposite order at the same time and in a conflicting mode. The actions taken to prevent a deadlock must deal with these characteristics.
Table 1 shows a list of preventive actions and the corresponding main effects.
| Actions | Spread Resources | Change the Locking Order | Decrease Concurrency | Change Locking Mode |
|---|---|---|---|---|
| Increase Index Freespace | X | |||
| Increase Index Subpage Size | X | |||
| Increase TS Freespace | X | |||
| Change Clustering Index | X | X | ||
| Reorg the Table Space | X | X | X | |
| Add an Index | X | X (1) | ||
| Drop an Index | X | |||
| Serialize the Transactions | X | |||
| Use additional COMMITS | X | |||
| Minimize the Response Time | X | |||
| Change Isolation Level (2) | X | X | ||
| Redesign Application | X | X | X | X |
| Redesign Database | X | X | X | X |
| Notes:
|
||||
To choose the right action, you must first understand
why the deadlock occurred. Then you can evaluate the actions to make
your choices. These actions can have several effects. They can:
- Solve the deadlock problem
- Force a change in access path for other transactions causing new deadlocks
- Cause new deadlocks in the system.
It is therefore important that you carefully monitor the access path used by the affected transactions, for example by the EXPLAIN facility in DB2. In many cases, solving deadlocks is an iterative process.