Transaction State in DBMS
Each and every transactions in DBMS, pass through several states during their lifespan. These states, known as "Transaction States," collectively constitute the "Transaction Lifecycle." Here are the main states in the lifecycle of a transaction:
- Active: This is the initial state of every transaction. In this state, the transaction is being executed. The transaction remains in this state as long as it is executing SQL statements.
- Partially Committed: When a transaction executes its final statement, it is said to be in a 'partially committed' state. At this point, the transaction has passed the modification phase but has not yet been committed to the database. If a failure occurs at this stage, the transaction will roll back.
- Failed: If a transaction is in a 'partially committed' state and a problem occurs that prevents the transaction from committing, it is said to be in a 'failed' state. When a transaction is in a 'failed' state, it will trigger a rollback operation.
- Aborted: If a transaction is rolled back and the database is restored to its state before the transaction began, the transaction is said to be 'aborted.' After a transaction is aborted, it can be restarted again, but this depends on the policy of the transaction management component of the DBMS.
- Committed: When a transaction is in a 'partially committed' state and the commit operation is successful, it is said to be 'committed.' At this point, the transaction has completed its execution and all of its updates are permanently stored in the database.
- Terminated: After a transaction reaches the 'committed' or 'aborted' state, it is said to be 'terminated.' This is the final state of a transaction.
Note: The actual terms and the number of states may vary depending on the specifics of the DBMS and the transaction processing model it uses. However, the fundamental principles remain the same.
Next Topic :Implementation of Atomicity and Durability in DBMS