Transaction and ACID properties

A set of statements executed on a resource or resources applied with ACID properties is known as Transaction.

Note: Here database is one resource but resource need not be only database

ACID Properties:

  • Atomicity
  • Consistency
  • Isolation
  • Durability

Atomicity:
This property describes that the set of statements involved in the transaction has to work as a single unit (i.e, automic). This is the minimum requirement that has to be met for a transaction

Consistency:
If the data used in the transaction is consistent before starting the transaction, then it has to be left in a consistent state even after the transaction.
Note: What is consistent data: data applied with some rules.
Example:

accountNo | accountBal
101        | 6000

Here lets define a rule that says if: accountBal>5000; then it is said to be in consistent state.
so before transaction it is 6000 and after transaction lets say it has become 8000, then it is left in consistent state. If it falls below 5000, ie, lets say 4000, then it is said to be inconsistent state in which case we will rollback the transaction

And if the data used in the transaction is already in inconsistent state then we cannot guarantee the consistent data after the transaction.

Isolation:
It is an ability to isolate the data used in one transaction from the other transaction.

Durability:

Once the transaction starts to save, it should definitely save all the statements within the transaction at any cost else rollback all the statements and throw exception.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Mawazo

Mostly technology with occasional sprinkling of other random thoughts

amintabar

Amir Amintabar's personal page

101 Books

Reading my way through Time Magazine's 100 Greatest Novels since 1923 (plus Ulysses)

Seek, Plunnge and more...

My words, my world...

ARRM Foundation

Do not wait for leaders; do it alone, person to person - Mother Teresa

Executive Management

An unexamined life is not worth living – Socrates

Diabolical or Smart

Nitwit, Blubber, Oddment, Tweak !!

javaproffesionals

A topnotch WordPress.com site

thehandwritinganalyst

Just another WordPress.com site

coding algorithms

"An approximate answer to the right problem is worth a good deal more than an exact answer to an approximate problem." -- John Tukey