Table of contents
Transaction Management:
Definition: Transaction management refers to the process of ensuring the integrity, consistency, and reliability of database operations by grouping them into logical units called transactions.
Purpose: Transaction management provides a mechanism to maintain the ACID properties of transactions and handle concurrent access and failures.
Transaction Properties:
Atomicity: A transaction is an atomic unit of work, meaning it is treated as a single, indivisible operation. It either succeeds completely or fails, leaving the database in its original state.
Consistency: A transaction brings the database from one consistent state to another consistent state. It must satisfy integrity constraints and preserve data integrity.
Isolation: Concurrently executing transactions are isolated from each other, so each transaction appears to execute in isolation without interference from other transactions.
Durability: Once a transaction commits, its effects are permanent and will survive any subsequent system failures or crashes.
Transaction States:
Active: The initial state when a transaction is executing.
Partially Committed: After the last operation of a transaction is executed, but before the commit operation is performed.
Committed: After the transaction has successfully completed and all changes have been made permanent.
Failed: If a transaction encounters an error and cannot continue.
Aborted: After a failed transaction has been rolled back, undoing any changes it made.
Concurrency Control: Techniques such as locking, timestamp ordering, and optimistic concurrency control are used to manage concurrent access to data and maintain transaction isolation.
ACID Properties:
Definition: ACID stands for Atomicity, Consistency, Isolation, and Durability. These properties ensure the reliability and integrity of transactions in a database system.
Atomicity: All operations within a transaction are treated as a single, indivisible unit of work. Either all operations are successfully completed, or none of them are.
Consistency: A transaction brings the database from one consistent state to another. It must satisfy integrity constraints and preserve data integrity.
Isolation: Concurrently executing transactions are isolated from each other, and each transaction appears to execute in isolation without interference from other transactions.
Durability: Once a transaction commits, its effects are permanent and will survive any subsequent system failures or crashes. The changes made by a committed transaction should persist in the database.