Transaction management Flashcards
Interleaving of operations
mix (digital signals) by alternating between them.
pessimistic locking
The use of locks based on the assumption that conflict between transactions is likely.
three main transaction problems
lost updates, uncommitted data, and inconsistent retrievals
lost updates

uncommitted data

inconsistent retrievals

- Explain the following statement: A transaction is a logical unit of work.
A transaction is a sequence of database operations that access the database. A trans- action is a logical unit of work; that is, all parts are executed or the transaction is aborted. A transaction takes a database from one consistent state to another.
- What is a consistent database state, and how is it achieved?
A consis- tent database state is one in which all data integrity constraints are satisfied.
- What is a transaction log, and what is its function?
The transaction log keeps track of all transactions that modify the database. The information stored in the transaction log is used for recovery (ROLLBACK) purposes
- List the four individual transaction properties.
Transactions have four main properties: atomicity, consistency, isolation, and dura- bility.
Atomicity
Atomicity means that all parts of the transaction must be executed; otherwise, the transaction is aborted.
Consistency
Consistency means that the database’s consistent state is maintained.
Isolation
Isolation means that data used by one transaction cannot be accessed by another transaction until the first one is completed.
Durability
Durability means that changes made by a transaction cannot be rolled back once the transaction is committed
B. (2 points) What is two-phase locking (2PL)? Give an example to illustrate how deadlock may happen with two phase locking.
The two-phase locking schema has a growing phase, in which the transaction acquires all of the locks that it needs without unlocking any data, and a shrinking phase, in which the transaction releases all of the locks without acquiring new locks.
What is a lock, and how does it work in general?
The scheduler uses locking to ensure the serializability of transactions.
A lock guarantees unique access to a data item by a transaction. The lock prevents one transaction from using the data item while another transaction is using it
- What are the different levels of lock granularity?
database, table, page, row, and field
- What is concurrency control, and what is its objective?
Concurrency control coordinates the simultaneous execution of transactions. The objective of concurrency control is to ensure the serializability of transactions in a multiuser database environment
serializability
the result of the concurrent execution of transactions is the same as that of the transactions being executed in serial order.
- What is an exclusive lock, and under what circumstances is it granted?
An exclusive lock is issued when a transaction wants to update (write to) the database and no other locks (shared or exclusive) are held on the data.
binary lock
binary lock can have only two states: locked (1) or unlocked (0).
shared lock
A shared lock is used when a transac- tion wants to read data from a database and no other transaction is updating the same data. Several shared or “read” locks can exist for a particular item
- What is a deadlock, and how can it be avoided? Discuss several strategies for dealing with deadlocks.
When two or more transactions wait indefinitely for each other to release a lock, they are in a deadlock, also called a deadly embrace. There are three deadlock control techniques: prevention, detection, and avoidance.
Two-Phase Locking

Difference between lost update and uncommitted data
- In uncomitted data one transaction must have accessed uncommited data from another transaction. In lost update this doesn’t happens