Session 3 : Transaction Management Flashcards
What is a Transaction?
A sequence of information exchanges and related actions,
such as database updates, deletions, modifications, or insertions.
Consistent State of Database?
- A successful transaction moves the database from one consistent state to another.
- During execution, the database may be in an inconsistent state until the transaction is fully processed.
- Transaction is considetered completed only when it is either fully commited or entirely aborded.
Database Request?
A database request refers to a single SQL statement executed within a transaction.
- If a transacrion consists of two UPDATE statements and one INSERT statement, it includes three database requests.
Single-user vs Multi-user systems.
Single : most one user can use the system at a time.
Multi : many users can use the system concurrently.
Single-processor vs Multi-processor computer system
Single-processor :
* Transactions execute sequentially.
* Which may lead to slower perforamnce
Multi-processor :
* Capable of parallel processing. (Interleaving)
* High performance can be expected
Interleaving ?
- Allows the DBMS to switch between operation of different transactions.
- Concurrency in database is achieved through the interleaving, where multipe transactions are executed seemingly at the same time.
4 important properties of transactions which DBMS must have?
ACID
- Atomicity
- Consistency
- Isolation
- Durability
- Atomicity : A transaction in DBMS is either completely executed or not executed at all.
- Consistency : Ensures the database remains in a vlid state. If consistency rules are violated, the transaction is rolled back, restoring the database to its original consistent state.
- Isolation : Transactions are executed independently of one another. Data in use during a transaction is inaccessible to another transaction until the transaction is complete.
- Durability : Committed data is permanently stored in the database. Once a transaction commits, its results are guaranteed to presist, even in case of system failures.
Serializability in DBMS?
Ensures that concurrent transactions produce a consistent database state.
Transaction states?
- BEGIN_TRANSACTION: marks start of transaction.
- READ OR WRITE: two possible operations on the data
- END_TRANSACTION: end of transaction process
- COMMIT_TRANSACTION: if no errors occur, save all changes to the database and mark transaction as complete.
- ROLLBACK OR ABORT: signals unsuccessful end of transaction, change applied to DB must be done.
Transaction Log?
A history of all transactions executed by a database system.
Transaction log content?
- transaction id
- for each transaction component:
* Type of operation
* Table name
* before and after values
* pointers - Transacion end