Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
11 views4 pages

Transaction and Concurrency Control

The document discusses the concept of transactions in databases, emphasizing the importance of ACID properties: Atomicity, Consistency, Isolation, and Durability. It explains how transactions must be executed to maintain data integrity and prevent concurrency issues, such as lost updates and uncommitted dependencies. Additionally, it covers resource locking mechanisms to manage concurrent access and ensure that transactions do not interfere with each other.

Uploaded by

islaamam55
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
11 views4 pages

Transaction and Concurrency Control

The document discusses the concept of transactions in databases, emphasizing the importance of ACID properties: Atomicity, Consistency, Isolation, and Durability. It explains how transactions must be executed to maintain data integrity and prevent concurrency issues, such as lost updates and uncommitted dependencies. Additionally, it covers resource locking mechanisms to manage concurrent access and ensure that transactions do not interfere with each other.

Uploaded by

islaamam55
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 4
Concut i — 92 concurren & Secu icv ansaction jon is defined as a logical unit of work. It consis ‘ consists vt must be completed together so that the database re either complete successfully or fail. ileal lore operations og transact in a consistent jabase th 0 teeation MUS mph ie 4 a the information of stock is stored in the database. SST tan quantity. When an items sold toa costomen ttieddel Goan ie Xe operation on the database, However, the quantity ofthe sod ted tothe sold is Mhrated from the items currently in stock. If both steps are not completed to mua syste be in an inconsistent state ‘The quantity of items in stock will be wrong if in sre Pe eubtracted from items in stock. The quantity will be wrong if the teme ns wn items in stock but not sold. Both of these operations together make up a both must complete successfully or both must fail. “pa sted fr0 sale ansaction and gid Commit and Rollback «tansaction is committed if it completes successfully and changes the data fit fails inj eaves the data unchanged i is said that the transaction has been rolled back. It means 2 lack s used to undo the work done in the current transaction. 91.2 Transaction Properties (ACID Properties) +s transaction must have four properties called ACID properties. These are as follows: 1, Atomicity ‘A transaction must be an atomic unit orcompletely fail. If any statement in transaction fails, When a transaction is executed successfully itis said to be committed. In case of failure ofastatement, all previous successful statements in transaction are rolled back or reverted to theprevious state of consistency. An incomplete transaction does not take place. 2,Consistency A transaction must leave the data in a consis! 2 bank database, money should never be "creates deposit or withdrawal. of work. A transaction must completely succeed the entire transaction fails completely. tent state after completion. For example, in .4” or “deleted” without an appropriate 3.Isolation All transactions that modi! the same data at the same time. Transactions must ‘tansactions. A’ modifying transaction can access “ansaction is completed. 4. Durability fy the data are isolated from each other. They do not access have no dependence or effect on other the data only before or after another ion are permanent and | The durability means that the modifications made by a transact a id be guaranteed to be complete: stent Ifthe system is crashed or rebooted, data shoul 'n the computer restarts. 52 Concurrency Cor : _ same currency is a situation in which Sitatong mee 18 @ multi-user environment, the concurrent access may arise to some ser ~ eS i data at two or more users access the same piece i tat concurrency occurs Very commonly: jous problems. he same dat ons update I ac w and then update the | e of other transactions. 7, It results in loss of data ct the same FO) js unawar transactions. attributes Product Code, Retrieve Qty. Retrieve QV: Qty. = 100 ty = 100. Update Qty = Qty - 90 Update Qty = Qty + 30 Table: Concurrency Problem Result; Team B's update is lst at 10:38 which is overwritten by Team A's update 2. Uncommitted Dependency Problem This problem arises when two or more transactions work on the same table. Oe transaction retrieves or updates certain part of data before other transaction rollbacks upiit on the same data. The uncommitted dependency occurs when a second transaction seleds! row that is being updated by another transaction. The second transaction is reading data ti! hhas not been committed yet and may be changed by the transaction that is updating ther" Example : Suppose the stock table contains a fi i seuerefstonsmay resulting | aNNY ith value 100, The fle database with « rechanism wi" Team A 7 Row level (Smallest lock granularity) o Page level o Table level © Database level (Largest lock granularity) ‘A lock with large granularity is easy to maintain for DBMS but may cause problems: lock with small granularity is difficult to maintain for DBMS but causes less problems. 9.4 Serializable Transaction Schedules d/write operations according, to ce t, we can examine which of be correctnes# A transaction consists of one or more rea sequence. When two or more transactions are present operations can be used without harming the original sequence. It ensures the increases efficiency. 9.4.1 Serial Schedule Serial schedule is a plan to execute transactions serially. The inte each transaction is preserved. A serial schedule ensures that each transacti is the only one accessing the database at one time. 9.4.2 Serializable Schedule int rmaleable Schedule is a non-serial schedule in whicl erleaved while ensuring, consistency. 9.4.3 Properties of Serializable Schedule * Aseriali . oot lenient schedule is equivalent to some serial schedule. * Itdoesn read and write conflicts which can effect database consisten ot suffer from issues such as, lost update, dirty read ete- nal sequen ion execut™ a . tio hh transaction oP

You might also like