# What is transaction processing? Explain the properties of the transaction(DBMS)

DBMSDatabaseBig Data Analytics

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 −

• A=A-150
• Write(A)