The document discusses concurrency control in database systems. It explains that concurrency control helps avoid problems from simultaneous transactions through coordination. This is accomplished using scheduling and locking methods. The document also discusses transaction logging, database recovery, deferred and write-through techniques, and examples of transactions using different lock types.
1 of 4
More Related Content
Database chapter 10 questions
1. Justin Andrews
ACSG 552
Chapter 10 Questions
2. The three most common concurrent transaction execution problems are lost updates,
uncommitted data, and inconsistent retrievals.
Concurrency control can help avoid these problems through its ability to coordinate
simultaneous executions of transactions in a multiprocessing database system. This is
accomplished with various methods, including the use of a scheduler and locks.
3. The DBMS component responsible for concurrency control is a scheduler, which is a
process that establishes the order in which the many operations during each transaction
are executed.
5. Database recovery takes place through the use of data in a given transaction log to
recover a database from an inconsistent to a consistent state. A write-ahead-log protocol
ensures that transaction logs are always written before any database data are actually
updated, ensuring that the database can later be recovered to a consistent state. Redundant
transaction logs ensure a physical disk failure will not impair the DBMS’s ability to
recover data. Database buffers are used to store copies of data from physical disks, which
are themselves updated when a transaction updates data, to help speed up operations. The
updated copies of data in the buffers are eventually used to update the data on the
physical disks. Checkpoints are the process in which a DBMS writes updated buffers
onto a disk, with no other requests being executed during it.
Deferred-write techniques delay the update of a physical database, only allowing the
transaction log to update. The database itself will only update after a given transaction
reaches a commit point, which uses information from the transaction log. If the
transaction aborts, no changes will be made, preventing a need to undo the changes.
Write-through techniques differ from deferred-write techniques as they proceed to have
the database updated immediately. When a transaction aborts in this instance, the changes
need to be undone through a ROLLBACK operation.
6. a. BEGIN TRANSACTION
UPDATE CUSTOMER
SET CUS_BALANCE = CUS_BALANCE + ((110 * 0.08) + 110)
WHERE CUS_CODE = ‘10010’
UPDATE CUSTOMER
SET CUS_DATELSTPUR = ‘05/11/10’
WHERE CUS_CODE = ‘10010’
UPDATE INVOICE
2. SET INV_NUMBER = ‘10983’
WHERE CUS_CODE = ‘10010’
UPDATE INVOICE
SET INV_TERMS = ‘30’
WHERE CUS_CODE = ‘10010’
UPDATE INVOICE
SET INV_DATE = ‘05/11/10’
WHERE CUS_CODE = ‘10010’
UPDATE INVOICE
SET INV_TOTAL = (110 * 0.08) + 110
WHERE CUS_CODE = ‘10010’
UPDATE INVOICE
SET INV_STATUS = ‘OPEN’
WHERE CUS_CODE = ‘10010’
COMMIT;
6. b. BEGIN TRANSACTION
UPDATE CUSTOMER
SET CUS_BALANCE = CUS_BALANCE – 100
WHERE CUS_CODE = ‘10983’
UPDATE CUSTOMER
SET CUS_DATELSTPMT = ‘06/03/10’
WHERE CUS_CODE = ‘10983’
UPDATE PAYMENT
SET PMT_ID = ‘3428’
WHERE CUS_CODE = ‘10983’
UPDATE PAYMENT
SET PMT_DATE = ‘06/03/10’
WHERE CUS_CODE = ‘10983’
UPDATE PAYMENT
SET PMT_AMT = 100
WHERE CUS_CODE = ‘10983’
UPDATE PAYMENT
SET PMT_TYPE = ‘CASH’
WHERE CUS_CODE = ‘10983’
3. COMMIT;
7.
TRANSACTION TRANSACTION WAIT/DIE WOUND/WAIT
REQUESTING OWNING LOCK SCHEME SCHEME
LOCK
T1 (11194185) T2 (13582019) T1 waits until T2 is T1 rolls back T2.
completed and T2 is rescheduled
releases its locks. while using the
same time stamp.
T2 (13582019) T1 (11194185) T2 rolls back. T2 waits until T1 is
T2 is rescheduled completed and
using the same time releases its locks.
stamp.
8. 1. Table-level lock – Necessary as both the CUSTOMER and INVOICE tables
are accessed.
2. Data manipulation – Regarding two instances of editing in the CUSTOMER
table.
3. Data manipulation – Regarding five instances of editing in the INVOICE table.
4. Table-level unlock – For when the data manipulation is finished.
9. 1. Row-level lock – Necessary for modifying information of a single customer in
the CUSTOMER table.
2. Row-level lock – Necessary for modifying information of a single invoice in
the INVOICE table.
3. Data manipulation – Regarding two instances of editing in the CUSTOMER
table.
4. Data manipulation – Regarding five instances of editing in the INVOICE table.
5. Row-level unlock – For when one is finished modifying the information in the
CUSTOMER table.
6. Row-level unlock – For when one is finished modifying the information in the
INVOICE table.
10. 1. Table-level lock – Necessary as both the CUSTOMER and PAYMENT tables
are accessed.
2. Data manipulation – Regarding two instances of editing in the CUSTOMER
table.
3. Data manipulation – Regarding four instances of editing in the PAYMENT
table.
4. Table-level unlock – For when the data manipulation is finished.
11. 1. Row-level lock – Necessary for modifying information of a single customer in
the CUSTOMER table.
4. 2. Row-level lock – Necessary for modifying information of a single invoice in
the PAYMENT table.
3. Data manipulation – Regarding two instances of editing in the CUSTOMER
table.
4. Data manipulation – Regarding four instances of editing in the PAYMENT
table.
5. Row-level unlock – For when one is finished modifying the information in the
CUSTOMER table.
6. Row-level unlock – For when one is finished modifying the information in the
PAYMENT table.