Database system is not just storing
data - the data has to be consistent
Important fact about the
data stored in a
database:
The data stored in a
database system represent
facts in
reality
There are
consistency constraints on
the data stored in the
database !
Example:
Consider a bank database that
store account balances of
customers
The database does not
simple storedata on
account balances....
There are account rules that
must be followed to keep
the dataconsistent !!
For example, when
customer Atransfers $100 to
customer B,
we must
perform the following
update:
Transaction: transfer $100 from A to B
read A
A.balance = A.balance - 100
write A
================================== system fails here
read B
B.balance = B.balance + 100
write B
If the system fails in the
middle of the
execution,
then the simplestable storage update policy
will recover A.balance − 100 but
will not set
B.balance to
B.balance + 100 !!
Then A would
lose
his $100 !!!
Database consistency and logging
In this part of the class notes, we will study:
Database consistency:
When we update some
data stored in the
database,
when will an
updatepreservedata integrity ?
Afterdefining the
notion of
database consistency, we will study
How to implement
techniques that will
ensuredatabase consistency