DBMS-LECTURE 13 Transactions
DBMS-LECTURE 13 Transactions
Atomicity
Requires that all operations (SQL requests) of
a transaction be completed; if not, then the
transaction is aborted
A transaction is treated as a single, indivisible,
logical unit of work
Durability
Indicates permanence of database’s consistent
state
When a transaction is complete, the database
reaches a consistent state. That state can not
be lost even if the system fails
lost updates
uncommitted data
inconsistent retrievals
Lock
Guarantees exclusive use of a data item to a
current transaction
T2 does not have access to a data item that is
currently being used by T1
Transaction acquires a lock prior to data access;
the lock is released when the transaction is
complete
Required to prevent another transaction from
reading inconsistent data
Lock manager
Responsible for assigning and policing the locks
used by the transactions
Database Systems 6e/ Rob & Coronel Slide 28
Lock Granularity
Indicates the level of lock use
Locking can take place at the following levels:
Database-level lock
Entire database is locked
Table-level lock
Entire table is locked
Page-level lock
Entire diskpage is locked
Row-level lock
Allows concurrent transactions to access different rows
of the same table, even if the rows are located on the
same page
Field-level lock
Allows concurrent transactions to access the same row,
as long as they require the use of different fields
(attributes) within that row
An entire disk page is locked (a table can span several pages and
each page can contain several rows of one or more tables)
Most frequently used multi-user DBMS locking method
Wound/wait
Older transaction rolls back the younger transaction
and reschedules it