Database Reference
In-Depth Information
Participate in Database and
Application Development
• Assist in the requirements analysis stage
and data model creation
• Play an active role in database design and
creation
Facilitate Changes to Database Structure
• Seek communitywide solutions
• Assess impact on all users
• Provide configuration control forum
Figure 9-2
Summary of DBa's
responsibilities for
Managing Database
Structure
• Be prepared for problems after changes are
made
• Maintain documentation
available that are more difficult to program or enforce but that allow more throughput. Still
other measures are available that maximize throughput but have a low level of concurrency
control. When designing multiuser database applications, you will need to choose among
these trade-offs.
The Need for Atomic Transactions
In most database applications, users submit work in the form of transactions , which are also
known as logical units of work (LUWs) . A transaction (or LUW) is a series of actions to be
taken on the database so that either all of them are performed successfully or none of them are
performed at all, in which case the database remains unchanged. Such a transaction is some-
times called atomic because it is performed as a unit.
Consider the following sequence of database actions that could occur when recording a
new order:
1.
Change a customer's row, increasing AmountDue.
2.
Change a salesperson's row, increasing CommissionDue.
3.
Insert a new order row into the database.
Suppose that the last step failed, perhaps because of insufficient file space. Imagine the
confusion if the first two changes were made but the third one was not. The customer would
be billed for an order never received, and a salesperson would receive a commission on an
order that was never sent to the customer. Clearly, these three actions need to be taken as a
unit—either all of them should be done or none of them should be done.
Figure 9-3 compares the results of performing these activities as a series of independent
steps (Figure 9-3(a)) and as an atomic transaction (Figure 9-3(b)). Notice that when the steps
are carried out atomically and one fails, no changes are made in the database. Also note that
the commands Start Transaction, Commit Transaction, and Rollback Transaction are issued
by the application program to mark the boundaries of the transaction logic. You will learn
more about these commands later in this chapter and in Chapters 10A, 10B, and 10C.
Concurrent Transaction Processing
When two transactions are being processed against a database at the same time, they are
termed concurrent transactions . Although it may appear to the users that concurrent
transactions are being processed simultaneously, this cannot be true because the CPU of
the machine processing the database can execute only one instruction at a time. Usually,
transactions are interleaved, which means that the operating system switches CPU services
among tasks so that some portion of each transaction is carried out in a given interval. This
 
Search WWH ::




Custom Search