lect(6) Transaction Management (1).pptx
Document Details
Uploaded by StylishSpessartine
جامعة العلوم والتقانة
Tags
Full Transcript
Database Management Systems Transaction Management Overview Chapter 18 Transactions Concurrent execution of user programs is essential for good DBMS performance. A user’s program may carry out many operations, but the DBMS is only concerned about read/written...
Database Management Systems Transaction Management Overview Chapter 18 Transactions Concurrent execution of user programs is essential for good DBMS performance. A user’s program may carry out many operations, but the DBMS is only concerned about read/written from/to the database. A transaction is the DBMS’s abstract view of a user program: a sequence of reads and writes. Concurrency in a DBMS Users submit transactions, and can think of each transaction as executing by itself. Concurrency is achieved by the DBMS, interleaves actions (reads/writes ) of various transactions. Each transaction must leave the database in a consistent state if the DB is consistent when the transaction begins. Atomicity of Transactions A transaction might commit after completing all its actions, or it could abort A very important property guaranteed by the DBMS for all transactions is that they are atomic. DBMS logs all actions so that it can undo the actions of aborted transactions. Example Consider two transactions (Xacts): T1: BEGIN A=A+100, B=B-100 END T2: BEGIN A=1.06*A, B=1.06*B END There is no guarantee that T1 will execute before T2 or vice-versa. However, the net effect must be equivalent to these two transactions running serially in some order. Example (Contd.) Scheduling Transactions Serial schedule: Schedule that does not interleave the actions of different transactions. Equivalent schedules: For any database state, the effect of executing the first schedule is identical to the effect of executing the second schedule. Scheduling Transactions con’d Serializable schedule: A schedule that is equivalent to some serial execution of the transactions.