Wednesday, November 18, 2015

ACID Properties

The four required properties of a database transaction are atomicity, consistency, isolation, and
durability.
Atomicity
Atomicity means that all the effects of the transaction must complete successfully or the changes are
rolled back. A classic example of an atomic transaction is a withdrawal from an ATM machine; the
machine must both dispense the cash and debit your bank account. Either of those actions completing
independently would cause a problem for either you or the bank.
Consistency
The consistency requirement ensures that the transaction cannot break the integrity rules of the
database; it must leave the database in a consistent state. For example, your system might require
that stock levels cannot be a negative value, a spare part cannot exist without a parent object, or the
data in a sex fi eld must be male or female. In order to be consistent, a transaction must not break
any of the constraints or rules defi ned for the data.
Isolation
Isolation refers to keeping the changes of incomplete transactions running at the same time separate
from one another. Each transaction must be entirely self-contained, and changes it makes must not
be readable by any other transaction, although SQL Server does allow you to control the degree of
isolation in order to fi nd a balance between business and performance requirements.
Durability
Once a transaction is committed, it must persist even if there is a system failure — that is, it must be
durable. In SQL Server, the information needed to replay changes made in a transaction is written to
the transaction log before the transaction is considered to be committed.

No comments:

Post a Comment