
- DBMS Tutorial
- DBMS - Home
- DBMS - Overview
- DBMS - Architecture
- DBMS - Data Models
- DBMS - Data Schemas
- DBMS - Data Independence
- Entity Relationship Model
- DBMS - ER Model Basic Concepts
- DBMS - ER Diagram Representation
- DBMS - Generalization, Aggregation
- Relational Model
- DBMS - Codd's Rules
- DBMS - Relational Data Model
- DBMS - Relational Algebra
- DBMS - ER to Relational Model
- DBMS- SQL Overview
- Relational Database Design
- DBMS - Database Normalization
- DBMS - Database Joins
- Storage and File Structure
- DBMS - Storage System
- DBMS - File Structure
- Indexing and Hashing
- DBMS - Indexing
- DBMS - Hashing
- Transaction And Concurrency
- DBMS - Transaction
- DBMS - Concurrency Control
- DBMS - Deadlock
- Backup and Recovery
- DBMS - Data Backup
- DBMS - Data Recovery
- DBMS Useful Resources
- DBMS - Quick Guide
- DBMS - Useful Resources
- DBMS - Discussion
What is transaction processing? Explain the properties of the transaction(DBMS)
A transaction is a unit of database processing which contains a set of operations. For example, deposit of money, balance enquiry, reservation of tickets etc.
Every transaction starts with delimiters begin transaction and terminates with end transaction delimiters. The set of operations within these two delimiters constitute one transaction.
main() { begin transaction } end transaction
Operations
The transaction has two basic operations −
Read(x) − Load the data-item x from database to memory. {Database is present in hard-disk}.
Write(x) − Update the data-item x in memory and store it in the database.
Properties of transaction
Database system ensures ACID property, which is explained below −
Atomicity − Either all or none of the transaction operation is done.
Consistency − A transaction transfer from one consistent (correct) state to another consistent state.
Isolation − A transaction is isolated from other transactions. i.e. A transaction is not affected by another transaction. Although multiple transactions execute concurrently it must appear as if the transaction are running serially (one after the other).
Durability − The results of a transaction are permanent i.e. the result will never be lost with subsequent failure, durability refers to long lasting i.e. permanency.
Example
Consider the transaction to transfer Rs. 150 from Account A to Account B. The steps for the transaction are as follows −
- Read A
- A=A-150
- Write(A)
- Read(B)
- B=B+150
- Write(B)
Atomicity is required if the transaction fails at step 4 and then there is inconsistency due to partial modification. This is because the value of B is not updated.
Consistency requirement − The sum of A and B should be the same before and after transaction.
Isolation requirement − If another transaction accesses data during step 4 then there is inconsistency because the value of B is not updated till now.
- Related Articles
- What are the states of transaction in DBMS?
- Explain check pointing in the transaction management system(DBMS)
- What is dirty read in a transaction(DBMS)?
- Explain serial execution or transaction with an example(DBMS)
- What are the different ways the transaction can be executed(DBMS)?
- What are different transaction isolation levels in DBMS?
- What will happen to the current MySQL transaction if a START TRANSACTION command is executed in the middle of that current transaction?
- What do you mean by a transaction in MySQL? Explain along with its properties?
- What happens to the current MySQL transaction if the session is ended in the middle of a transaction?
- What is a shielded transaction?
- What will happen to MySQL current transaction, if in the middle of that transaction, the DDL statement is executed?
- Differentiate between cash transaction and credit transaction
- Which statement, other than START TRANSACTION, is used for starting a transaction?
- What happens when we use COMMIT in MySQL stored procedure and one of the transaction, under START transaction, fails?
- Definition of Transaction in Database
