Database Reference
In-Depth Information
and the effects of incomplete updates are rolled back, the database is restored
to its old consistent state. In either case, the transaction leaves the database in a
consistent state.
Let us now summarize the key points of a database transaction:
A transaction is an atomic unit of work.
A transaction must leave the database in a consistent state; it must either be
completed in its entirety or not all.
The database management system cannot detect the beginning and end points
of each individual transaction within an application unless the boundary points
are marked by specific statements.
Data manipulation languages provide specific statements of BEGIN,
COMMIT, ABORT, and ROLLBACK that can be included in the application
program. The BEGIN statement signifies the start of a transaction; COMMIT
the end of a transaction after successful database updates; ROLLBACK the
end of a transaction after rolling back the effects of unsuccessful database
updates.
When a transaction completes, two outcomes are possible—a new consistent
state of the database or partial database updates rolled back and the database
restored to its old consistent state.
Transactions of the same program cannot be nested. Only while a transaction
is in progress can COMMIT and ROLLBACK commands be performed.
Each transaction must be executed only once as written, not repeatedly.
If the start and end of transactions are not marked with specific statements, the
database management assumes the beginning and end of the entire program
as the start and end points of the transactions within the program.
Properties of Transactions
You must already have noticed that database transactions need to behave in a
certain way to preserve data consistency, correctness, and validity. Unless transac-
tions execute properly, users cannot trust the data in the database. They cannot
depend on the database system to provide them with correct and consistent
information.
Analyzing the required behavior of database transactions, we come up with four
basic, essential properties that each database transaction must possess. The acronym
ACID refers to these fundamental properties: A for atomicity, C for consistency, I
for isolation, and D for durability. When a transaction has these four properties, it
will maintain the consistency, correctness, and validity of a database. Let us examine
and describe these properties.
Atomicity A transaction is said to be atomic if it executes all of its database
updates or none at all. An atomic transaction is considered to be one complete unit
of work—either the entire work in the unit gets done or the bad effects of no part
of the work are left behind in the database.
The transaction management component of the database management system
(DBMS) handles atomicity.
Search WWH ::




Custom Search