consistent state vs inconsistent state
Transactions are the features that keep database in a consistent state.
It is shift change from file base system to database system.
Database system implements transactions.
suppose we have two acounts
c:5000---checking
s:4000---savin
you are said to add from c into s 1000
1>read how much new amt in checking act
2>deduct 1000 from c act
3>write the new amt in c act
4>reas s
5>add 1000 to s
6>write new amt in s
these steps are transaction
observations
total sum at start in 9000
total sum at end is 9000
this is called consistency
now lets suppose after step 3 something happens and you are not able to do next steps,
this will lead to unconsistent data
so we have to undo the 1st three steps
either do all steps or do none--atomicity
after the transactions the data is permament #durability
If two transactions works concurrently
we have to make sure their work not interfere with each other.
i.e the transactions should work in isolation
so every transaction should follow ACID properties of (fundamental prperties of transaction)
A---atomicity
C---consistency
I-----isolation
D----durability
all databases implement these four properties .
how cuncurrent transactions are maintained
transaction control language TCL
commit
savepoint
rollback
No comments:
Post a Comment