Why Transactions?
Perhaps the first question to answer is “Why transactions?” There are a number of reasons to include transactional support in your applications. The most common ones are the following:
Recoverability Applications often need to ensure that no matter how the system or application fails, previously saved data is available the next time the application runs.
Deadlock avoidance When multiple threads of control change the database at the same time, there is usually the possibility of deadlock; that is, each of the threads of control owns a resource that another thread wants, so no thread is able to make forward progress—all waiting for a resource. Deadlocks are resolved by having one of the operations involved release the resources ...