0% found this document useful (0 votes)
4 views3 pages

Detailed Transaction Processing Notes

Transaction processing in DBMS ensures reliable operations through the bundling of multiple SQL operations into a single transaction that adheres to ACID properties. Key components include concurrency control and recovery managers, while schedules must be recoverable and serializable. SQL provides commands for managing transactions, ensuring consistency and rollback capabilities.

Uploaded by

aaliyakaunain98
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Detailed Transaction Processing Notes

Transaction processing in DBMS ensures reliable operations through the bundling of multiple SQL operations into a single transaction that adheres to ACID properties. Key components include concurrency control and recovery managers, while schedules must be recoverable and serializable. SQL provides commands for managing transactions, ensuring consistency and rollback capabilities.

Uploaded by

aaliyakaunain98
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Detailed Notes on Transaction

Processing in DBMS
1. Introduction to Transaction Processing
Transaction processing is a crucial functionality of Database Management Systems
(DBMS) that ensures the reliability of operations performed on a database. It allows
multiple operations to be bundled into a single transaction which is executed as one
unit. If any of the operations fail, the entire transaction is rolled back to maintain
consistency.

Use Cases:
- Banking systems: Transferring funds from one account to another.
- Online shopping: Placing an order and reducing inventory.
- Airline reservations: Booking and updating available seats.

2. What is a Transaction?
A transaction is a sequence of one or more SQL operations that perform a logical
unit of work. Transactions must exhibit the ACID properties to ensure database
integrity, especially in multi-user environments.

Example - Fund Transfer:


1. Deduct $100 from Account A
2. Add $100 to Account B
This must be treated as one unit. If the system crashes after step 1 and before step 2,
money would be lost.

3. System Concepts
Transaction processing involves several components and states:

Components:
- Concurrency Control Manager: Manages simultaneous transaction execution to
avoid conflicts.
- Recovery Manager: Restores the database to a consistent state in case of failure.

Transaction States:
- Active: Transaction is being executed.
- Partially Committed: Last operation executed, awaiting commit.
- Committed: All operations completed successfully.
- Failed: An error has occurred during transaction.
- Aborted: Transaction is rolled back due to a failure.

4. Desirable Properties of Transactions (ACID)


Transactions must satisfy the following ACID properties:

1. Atomicity: Ensures that all operations within a transaction are completed


successfully. If not, the transaction is aborted.
2. Consistency: The database remains in a consistent state before and after the
transaction.
3. Isolation: Ensures that transactions are securely and independently processed at
the same time without interference.
4. Durability: Guarantees that once a transaction is committed, it remains so, even in
the event of a system failure.

5. Recoverability in Schedules
Schedules are the sequences in which transactions' operations are executed.
Recoverability ensures that the database can be restored to a consistent state after a
crash.

Types:
- Recoverable Schedules: A transaction commits only after the transactions it
depends on have committed.
- Cascadeless Schedules: Transactions only read data written by committed
transactions, preventing cascading rollbacks.
- Strict Schedules: Transactions cannot read or write data modified by another
uncommitted transaction.

6. Serializability of Schedules
Serializability is the main criterion for correctness in concurrent transactions. It
ensures the result of concurrent execution is the same as if the transactions were
executed serially.

Types of Serializability:
- Conflict Serializability: Determined by analyzing conflicting operations
(read/write).
- View Serializability: Based on the view of transactions and final results. More
complex to test.

7. Conflict vs View Serializability


- Conflict Serializable Schedule: Operations can be swapped if they don’t conflict
(i.e., read/write on the same data).
- View Serializable Schedule: Transactions may have different operation orders but
read/write the same values and produce the same final outcome.

Conflict serializability is easier to enforce and often used in real-world systems.

8. Transaction Support in SQL


SQL provides explicit control over transaction boundaries using specific commands:

- BEGIN TRANSACTION: Starts a new transaction.


- COMMIT: Saves all changes made during the transaction.
- ROLLBACK: Undoes all changes since the last COMMIT.
- SAVEPOINT: Creates a point within a transaction that you can roll back to.

Example:
BEGIN TRANSACTION;
UPDATE accounts SET balance = balance - 100 WHERE id = 'A';
UPDATE accounts SET balance = balance + 100 WHERE id = 'B';
COMMIT;

9. Summary
Transaction processing is essential for reliable database systems. Key points
include:
- A transaction is a logical unit of work.
- ACID properties ensure reliability.
- Schedules must be recoverable and serializable.
- SQL offers transaction control mechanisms for managing consistency and rollback.

You might also like