Database Administration and Tuning
|
|
- Anna Perkins
- 5 years ago
- Views:
Transcription
1 Department of Computer Science and Engineering 2013/2014 Database Administration and Tuning Mini- Project 2 - solution 2nd semester Question 1 Equivalence Between Relational Algebra Expressions Consider the following two information needs, and consider the alternative SQL queries that are presented to address these information needs. Information Need 1 Information Need 2 SELECT * FROM T1 JOIN (T2 EXCEPT T3) TR ON T1.A1 = TR.B1 ( SELECT * FROM T1 JOIN T2 ON T1.A1 = T2.B1 ) EXCEPT ( SELECT * FROM T1 JOIN T3 ON T1.A1 = T3.B1 ) SELECT T1.A2 FROM T1 LEFT OUTER JOIN T2 ON T1.A1 = T2.B1 WHERE T1.A2 > 10 SELECT T1.A2 FROM ( SELECT * FROM T1 WHERE T1.A2 > 10) TR LEFT OUTER JOIN T2 ON TR.A1 = T2.B1 (a) Write the four SQL queries in the form of relational algebra expressions, considering a direct translation for the SQL instructions that are shown. (b) Using the equivalence rules between relational algebra expressions, show that the two alternative SQL queries presented for each information need are indeed equivalent. (c) For each of the information needs, explain how one of the considered alternative queries can be said to be more efficient. Question 2 Query Optimization and Estimation of Join Sizes Consider the following two relations: R ( A, B, C ) S (C, D) Consider also the following information, regarding the two relations: IST/DEI Pág. 1 de 12
2 Nr tuples R = Nr tuples S = 5000 V(R, A) = 20 V(R, B) = 50 V(S, C) = 200 V(R, C) = 150 V(S, D) = 30 Estimate the number of tuples that results from the expression π A,C,D [ (σ A=3 AND B=5 R) X S] Question 3 Transaction Isolation Levels and Associated Problems Consider a relational database for information related to product sales in a store, with the following four tables. The tables are slightly modified versions of those that are available in the AdventureWorks database: PRODUCTION.PRODUCT ( ProductID, Name, ListPrice, QuantityInStock ) SALES.CUSTOMER ( CustomerID, Phone, , FirstName, LastName ) SALES.SALE ( SaleID, DeliveryAddress, CreditCard, SaleDate, CustomerID, SaleTotal ) SALES.SALE_PRODUCT ( SaleID, ProductID, Quantity ) Assume that the following three stored procedures can run concurrently in a given application that is supported by the relational database: create_product : creates new rows in the PRODUCTION.PRODUCT table, for new products that will be sold in the store. This procedure uses only the PRODUCTION.PRODUCT table to insert new products. create_modify_sale: records new records, or modifies existing SALES.SALE and SALES.SALE_PRODUCT information. This procedure writes to the SALES.SALE and SALES.SALE_PRODUCT tables, updates the corresponding tuples in the PRODUCTION.PRODUCT table, and may be reading from the SALES.CUSTOMER and PRODUCTION.PRODUCT tables. create_customer: records new customer data in the database. This procedure uses only the SALES.CUSTOMER table to insert new customers. (a) Give a scenario that leads to a possible dirty read in the concurrent execution of operations from this group of stored procedures, or explain why a dirty read cannot happen in this group of stored procedures. (b) Give a scenario that leads to a possible non- repeatable read in the concurrent execution of operations from this group of stored procedures, or explain why a non- repeatable read cannot happen in this group of stored procedures. IST/DEI Pág. 2 de 12
3 (c) Give an example of a possible phantom read in the concurrent execution of operations from this group of stored procedures, or explain why a phantom read cannot happen in this group of stored procedures. (d) Indicate what transaction isolation level would you use for executing each of the three procedures above, and why? For each procedure you should use the least restricted transaction isolation level that ensures correctness. (d) Consider now an abstract situation, involving the concurrent execution of two transactions. In the description shown bellow, X() means acquiring an exclusive lock, S() means acquiring a shared lock, R() refers to a read operation, and W() refers to a write operation. All locks are released during commit or abort. T1: X(A), R(A), W(A), X(B), R(B), W(B), Commit T2: X(B), R(B), W(B), S(A), R(A), Abort Indicate which of the following problems can occur if the following transactions run concurrently, and explain why: Deadlock in the execution of both transactions; Dirty read in transaction T1; Non- repeatable read in transaction T2; Question 4 Concurrency Control 4.1. Consider the following schedule for two concurrent transactions: T1 T2 1 lock- S(A) 2 read(a) 3 lock- X(B) 4 write(b) 5 unlock(b) 6 lock- S(B) 7 read(b) 8 unlock(a) 9 unlock(b) (a) Is the schedule allowed in Strict 2- Phase Locking? Justify. (b) Is the schedule allowed by the timestamp- based protocol? Justify. IST/DEI Pág. 3 de 12
4 4.2. Consider now the following schedule for three concurrent transactions: T1 T2 T3 1 write(a) 2 write(a) 3 write(a) 4 write(b) 5 write(b) (a) Is the schedule allowed in Strict 2- Phase Locking? Justify. (b) Is the schedule allowed by the timestamp- based protocol? Justify. Question 5 Recovery System Consider the following simplified representation for the log records that correspond to a given execution, and suppose the ARIES algorithm is followed by the recovery system: LSN Type Transaction Page 00 Begin_checkpoint End_checkpoint Update T1 P1 30 Update T2 P2 40 Update T3 P3 50 Commit T2-60 Update T3 P2 70 Update T1 P5 CRASH!!! Consider also that the system crashes during recovery from the crash that is represented above, after writing two log records to stable storage. Note that the active transaction table and the dirty page table are empty at the time of the checkpointing. Show the contents of the log after (a) the analysis phase, (b) the redo phase, and (c) the undo phase. IST/DEI Pág. 4 de 12
5 Solutions to Question 1 The two equivalent expressions for the first information need are as follows: T1 X (T1.A1 = B1) (T2 T3) (T1 X (T1.A1 = T2.B1) T2) (T1 X (T1.A1 = T3.B1) T3) The two equivalent expressions for the second information need are as follows: (b) π T1.A2 ( δ (T1.A2 > 10) (T1 = X (T1.A1 = T2.B1) T2) ) π T1.A2 ( (δ (T1.A2 > 10) (T1)) = X (T1.A1 = T2.B1) T2 ) In the case of the first information need, let us rename (T1 X (T1.A1 = B1) (T2 T3)) as R1, (T1 X (T1.A1 = T2.B1) T2) as R2 and (T1 X (T1.A1 = T3.B1) T3) as R3. If a tuple t belongs to R1, it will also belong to R2. If a tuple t belongs to R3, then t will belong to T3, and hence t cannot belong to R1. From these two we can say that: t, t R1 t (R2 R3) If a tuple t belongs to R2 R3, then t will belong to T2 and t will not belong to T3. Therefore: t, t (R2 R3) t R1 The above two equations imply the given equivalence, in the case of the first information need. In the case of the second information need, let us first notice that the selection condition (T1.A2 > 10) uses only attributes from T1. Therefore, if any tuple t in the output of the operation (T1 = X T2) is filtered out by the selection of the left hand side, then all the tuples in T1 whose value is equal to t are filtered out by the selection of the right hand side. Therefore: t, t NOT- IN δ (T1.A2 > 10) (T1 = X (T1.A1 = T2.B1) T2) t NOT- IN (δ (T1.A2 > 10) (T1) = X (T1.A1 = T2.B1) T2 Using a similar reasoning, we can also conclude that: IST/DEI Pág. 5 de 12
6 t, t NOT- IN (δ (T1.A2 > 10) (T1)) = X (T1.A1 = T2.B1) E2 t NOT- IN δ (T1.A2 > 10) (T1 = X (T1.A1 = T2.B1) T2) The above two equations imply the given equivalence, in the case of the second information need. (c) The first equivalence is helpful because evaluation of the right hand side of the equivalence may avoid producing many output tuples, which are anyway going to be removed from the result. Thus the right hand side expression (i.e., the one where the minus is executed prior to the join) can in principle be evaluated more efficiently than the left hand side expression. The second equivalence is also helpful because evaluation of the right hand side join (i.e., the expression involving the selection only after the join) may involve many tuples, which will finally be removed from the result. The left hand side expression can, in principle, be evaluated more efficiently, given that the selection is used to filter results prior to the join. Solutions to Question 2 R ( A, B, C ) S (C, D) Nr tuples R = Nr tuples S = 5000 V(R, A) = 20 V(R, B) = 50 V(S, C) = 200 V(R, C) = 150 V(S, D) = 30 π A,C,D [ (σ A=3 AND B=5 R) X S] Nb tuples (σ A=3 AND B=5 R) = Nb tuples (σ A=3 (σ B=5 R)) Nb tuples (σ B=5 R) = Nr tuples R/V(R, B) = 10000/50 = 200 Nb tuples (σ A=3 (σ B=5 R)) = Nb tuples (σ B=5 R)/V(σ B=5 R, A) = 200/20 = 10 Y = (σ A=3 AND B=5 R) Attributes Y Attributes S = C is not a key of Y nor S V(Y, C) = V(R, C) = 150 Nr tuples (Y X S) = min ( (Nb Tuples Y*Nb tuples S)/V(S, C), (Nb Tuples Y*Nb tuples S)/V(Y, C) ) = IST/DEI Pág. 6 de 12
7 = min (10*5000/200, 10 *5000/150) = 500/2 = 250 Z = (σ A=3 AND B=5 R) X S Nr tuples Z = 250 Nb tuples π A, B, C,D [ (σ A=3 AND B=5 R) X S] = V(Z, (A,B,C,D)) {A,B,C,D} contains attributes from Y and from S, in particular A1 = {A,B,C} belongs to Y and A2 = {C,D} belongs to S, so: V(Z, (A,B,C,D)) = min ( V(Y, (A,B,C)) * V(S, D), V(Y, (A,B))*V(S, (C,D)), Nb tuples Z) V(Y, (A,C,D)) = min (V(Y,A) * V(Y,C)*V(Y,C), Nb tuples Y) = min(1*1*150, 10) = 10 V(Y, (A,B)) = min (V(Y,A)*V(Y,B), Nbtuples Y) = min(1, 10) = 1 V(S, (C,D)) = min (V(S,C) * V(S,D), Nb tuples S) = min(200*30, 5000) = 5000 Therefore: V(Z, (A,B,C,D)) = min ( V(Y, (A,B,C)) * V(S, D), V(Y, (A,B))*V(S, (C,D)), Nb tuples Z) = = min (10*30, 1*5000, 250) = = min(300, 5000, 250) = 250 Solutions to Question 3 (a) A dirty read can occur when having two concurrent transactions executing the operation named create_modify_sale. For instance, a transaction T1 can start its execution in the read uncommitted isolation level. Concurrently, a transaction T2 starts to create a sale for that same product, and registers a change in the QuantityInStock attribute. Before transaction T2 commits, transaction T1 can read a dirty value for the QuantityInStock attribute. (b) A non- repeatable read can occur when having two concurrent transactions executing the operation named create_modify_sale. For instance, a transaction T1 can start its execution in either the read uncommitted or the read committed isolation level, and read the QuantityInStock attribute for a given product. Concurrently, a transaction T2 creates a sale for that same product and commits. Transaction T1 will then use an incorrect value when updating the value for the QuantityInStock attribute, resulting from the read of a different value for the QuantityInStock attribute. (c) A phantom read will not occur in the concurrent execution of the three stored procedures described in this exercise, given that there are no operations for deleting tuples from the PRODUCTION.PRODUCT or SALES.CUSTOMER tables, and given that the IST/DEI Pág. 7 de 12
8 create_modify_sale procedure only reads data from specific tuples in the PRODUCTION.PRODUCT and SALES.CUSTOMER tables (i.e., there are no range- queries involved). (d) I would use the read uncommitted isolation for executing create_product and create_customer, given that these stored procedures do not perform reads, and they only insert new tuples into the PRODUCTION.PRODUCT and SALES.CUSTOMER tables (i.e., assuming that these creation operations can be performed atomically, and that adding a new tuple does not involve checking for the existence of another tuple with the same primary key otherwise one can choose the read committed isolation level). I would use repeatable read for the create_modify_sale procedure, in order to avoid the problem of non- repeatable reads. (e) A deadlock can occur in the concurrent execution of both transactions, as shown in the following example: T1: X(A) T2: X(B) T1: R(A) T1: W(A) T1: X(B) - holds until T2 releases X- lock on B T2: S(A) - holds until T1 releases X- lock on A DEADLOCK A dirty read cannot happen in transaction T1, given that both transactions acquire X- locks on the variables before write operations, and S- locks on the variables before read operations. We also have that a non- repeatable read cannot occur in transaction T2, given that the transactions hold the locks (X- locks and S- locks) until the commit or abort operations, never "downgrading" them. In brief, we have that two- phase locking ensures serializable schedules. Solutions to Question This schedule is not allowed in the timestamp protocol because at step 7, the W- timestamp of B is TS(T1) and TS(T0) < W- timestamp(b). The schedule is allowed under S2PL because each transaction first requests locks and once starts to unlock, doesn t request any more locks (2PL) and because each transaction can keep its exclusive locks until the commit time. This means that T2 must commit at time T5 and T2 at time T This schedule cannot have lock instructions added to make it legal under strict two- phase locking protocol because T1 must unlock (A) between steps 2 and 3, and must lock IST/DEI Pág. 8 de 12
9 (B) between steps 4 and 5. The schedule works under timestamp- based protocol, because each time there is a write operation over A (or B), the timestamp of the transaction Ti, TS(Ti) >= W- timestamp(a/b). Solutions to Question 5 LSN Type Transaction Page 00 Begin_checkpoint End_checkpoint Update T1 P1 30 Update T2 P2 40 Update T3 P3 50 Commit T2-60 Update T3 P2 70 Update T1 P5 CRASH!!! a) 1 st Analysis phase (after 1 st crash): LSN 20 Add (T1,20) to TT and (P1,20) to DPT LSN 30 Add (T2,30) to TT and (P2,30) to DPT LSN 40 Add (T3,40) to TT and (P3,40) to DPT LSN 50 Change status of T2 to C LSN 60 Change (T3,40) to (T3,60) LSN 70 Change (T1,20) to (T1,70) and add (P5,70) to DPT At the end of analysis, the transaction table (ATT) contains the following entries: (T1,70,U), (T2,50,C) and (T3,60,U). The Dirty Page Table (DTP) has the following entries: (P1,20), (P2,30), (P3,40), and (P5,70). No changes to the log b) 1 st Redo phase (after 1 st crash):: Redo starts from LSN20 (minimum reclsn in DPT). LSN 20 Check whether P1 has pagelsn more than 10 or not. LSN 30 Redo the change in P2 IST/DEI Pág. 9 de 12
10 LSN 40 Redo the change in P3 LSN 50 No action LSN 60 Redo the changes on P2 LSN 70 Redo the changes on P5 Since T2 is committed, write record: LSN 80 T2 end in the log and remove T2 from the ATT. c) 1 st Undo phase (after 1 st crash):: ToUndo list consists of (70, 60). Read LSN 70: Undo the changes in P5. Append a CLR: Undo T1 LSN 70, undonextlsn = 20. Add 20 to ToUndo list. 2 nd CRASH! d) 2nd Analysis phase (after 2nd crash): LSN 20 Add (T1,20) to TT and (P1,20) to DPT LSN 30 Add (T2,30) to TT and (P2,30) to DPT LSN 40 Add (T3,40) to TT and (P3,40) to DPT LSN 50 Change status of T2 to C LSN 60 Change (T3,40) to (T3,60) LSN 70 Change (T1,20) to (T1,70) and add (P5,70) to DPT LSN 80 Remove T2 from ATT At the end of analysis, the transaction table (ATT) contains the following entries: (T1,90,U) and (T3,60,U). The Dirty Page Table (DTP) has the following entries: (P1,20), (P2,30), (P3,40), and (P5,70). No changes to the log e) 2nd Redo phase (after 2nd crash):: Redo starts from LSN20 (minimum reclsn in DPT). LSN 20 Check whether P1 has pagelsn more than 10 or not. Since it is a committed transaction, we probably do not need to redo this update. LSN 30 Redo the change in P2 LSN 40 Redo the change in P3 IST/DEI Pág. 10 de 12
11 LSN 50 No action LSN 60 Redo the changes on P2 LSN 70 Redo the changes on P5 LSN 80 No action LSN 90 Redo Undo the changes on P5 No changes to the log- f) 2nd Undo phase (after 2ndcrash):: ToUndo list consists of (90, 60). Read LSN 90: CLR with undonextlsn = 20 so Add 20 to ToUndo list. ToUndo consists of (60, 20). Read LSN 60: Undo the changes on P2. Append a 100 CLR: Undo T3 LSN 60 with undonextlsn = 40. Add 40 to ToUndo. ToUndo consists of (40, 20). Read LSN 40: Undo the changes on P3. Append two records to the log: 110 CLR:Undo T3 LSN 40 with undonextlsn =null 120 T3 End ToUndo consists of (20). Read LSN 20: Undo the changes on P1. Append two records to the log: 130 CLR: Undo T1 LSN 20 with undonextlsn =null 140 T1 End The log looks like the following after recovery: LSN 00 begin checkpoint LSN 10 end checkpoint LSN 20 update: T1 writes P1 LSN 30 update: T2 writes P2 LSN 40 update: T3 writes P3 LSN 50 T2 commit prevlsn = 30 LSN 60 update: T3 writes P2 prevlsn = 40 LSN 70 update: T1 writes P5 prevlsn = 20 IST/DEI Pág. 11 de 12
12 LSN 80 T2 end LSN 90 CLR: Undo T1 LSN 70 undonextlsn= 20 LSN 100 CLR: Undo T3 LSN 60 undonextlsn= 40 LSN 110 CLR: Undo T3 LSN 40 undonextlsn= null LSN 120 T3 end LSN 130 CLR: Undo T1 LSN 20 undonextlsn= null LSN 140 T1 end IST/DEI Pág. 12 de 12
INSTITUTO SUPERIOR TÉCNICO Administração e optimização de Bases de Dados
-------------------------------------------------------------------------------------------------------------- INSTITUTO SUPERIOR TÉCNICO Administração e optimização de Bases de Dados Exam 1 - Solution
More informationSlides Courtesy of R. Ramakrishnan and J. Gehrke 2. v Concurrent execution of queries for improved performance.
DBMS Architecture Query Parser Transaction Management Query Rewriter Query Optimizer Query Executor Yanlei Diao UMass Amherst Lock Manager Concurrency Control Access Methods Buffer Manager Log Manager
More informationLast time. Started on ARIES A recovery algorithm that guarantees Atomicity and Durability after a crash
ARIES wrap-up 1 Last time Started on ARIES A recovery algorithm that guarantees Atomicity and Durability after a crash 2 Buffer Management in a DBMS Page Requests from Higher Levels BUFFER POOL disk page
More informationConcurrency Control! Snapshot isolation" q How to ensure serializability and recoverability? " q Lock-Based Protocols" q Other Protocols"
Concurrency Control! q How to ensure serializability and recoverability? q Lock-Based Protocols q Lock, 2PL q Lock Conversion q Lock Implementation q Deadlock q Multiple Granularity q Other Protocols q
More informationCOURSE 4. Database Recovery 2
COURSE 4 Database Recovery 2 Data Update Immediate Update: As soon as a data item is modified in cache, the disk copy is updated. Deferred Update: All modified data items in the cache is written either
More informationIntroduction. Storage Failure Recovery Logging Undo Logging Redo Logging ARIES
Introduction Storage Failure Recovery Logging Undo Logging Redo Logging ARIES Volatile storage Main memory Cache memory Nonvolatile storage Stable storage Online (e.g. hard disk, solid state disk) Transaction
More informationTransaction Management & Concurrency Control. CS 377: Database Systems
Transaction Management & Concurrency Control CS 377: Database Systems Review: Database Properties Scalability Concurrency Data storage, indexing & query optimization Today & next class Persistency Security
More informationReview: The ACID properties. Crash Recovery. Assumptions. Motivation. More on Steal and Force. Handling the Buffer Pool
Review: The ACID properties A tomicity: All actions in the Xact happen, or none happen. Crash Recovery Chapter 18 If you are going to be in the logging business, one of the things that you have to do is
More informationCSE 444, Winter 2011, Midterm Examination 9 February 2011
Name: CSE 444, Winter 2011, Midterm Examination 9 February 2011 Rules: Open books and open notes. No laptops or other mobile devices. Please write clearly. Relax! You are here to learn. An extra page is
More informationACID Properties. Transaction Management: Crash Recovery (Chap. 18), part 1. Motivation. Recovery Manager. Handling the Buffer Pool.
ACID Properties Transaction Management: Crash Recovery (Chap. 18), part 1 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke CS634 Class 20, Apr 13, 2016 Transaction Management
More informationCrash Recovery. The ACID properties. Motivation
Crash Recovery The ACID properties A tomicity: All actions in the Xact happen, or none happen. C onsistency: If each Xact is consistent, and the DB starts consistent, it ends up consistent. I solation:
More informationOutline. Purpose of this paper. Purpose of this paper. Transaction Review. Outline. Aries: A Transaction Recovery Method
Outline Aries: A Transaction Recovery Method Presented by Haoran Song Discussion by Hoyt Purpose of this paper Computer system is crashed as easily as other devices. Disk burned Software Errors Fires or
More informationA tomicity: All actions in the Xact happen, or none happen. D urability: If a Xact commits, its effects persist.
Review: The ACID properties A tomicity: All actions in the Xact happen, or none happen. Logging and Recovery C onsistency: If each Xact is consistent, and the DB starts consistent, it ends up consistent.
More informationCrash Recovery. Chapter 18. Sina Meraji
Crash Recovery Chapter 18 Sina Meraji Review: The ACID properties A tomicity: All actions in the Xact happen, or none happen. C onsistency: If each Xact is consistent, and the DB starts consistent, it
More informationThe transaction. Defining properties of transactions. Failures in complex systems propagate. Concurrency Control, Locking, and Recovery
Failures in complex systems propagate Concurrency Control, Locking, and Recovery COS 418: Distributed Systems Lecture 17 Say one bit in a DRAM fails: flips a bit in a kernel memory write causes a kernel
More informationName Class Account UNIVERISTY OF CALIFORNIA, BERKELEY College of Engineering Department of EECS, Computer Science Division J.
Do not write in this space CS186 Spring 2001 Name Class Account UNIVERISTY OF CALIFORNIA, BERKELEY College of Engineering Department of EECS, Computer Science Division J. Hellerstein Final Exam Final Exam:
More informationCrash Recovery Review: The ACID properties
Crash Recovery Review: The ACID properties A tomicity: All actions in the Xacthappen, or none happen. If you are going to be in the logging business, one of the things that you have to do is to learn about
More informationConcurrency control 12/1/17
Concurrency control 12/1/17 Bag of words... Isolation Linearizability Consistency Strict serializability Durability Snapshot isolation Conflict equivalence Serializability Atomicity Optimistic concurrency
More informationUNIT 9 Crash Recovery. Based on: Text: Chapter 18 Skip: Section 18.7 and second half of 18.8
UNIT 9 Crash Recovery Based on: Text: Chapter 18 Skip: Section 18.7 and second half of 18.8 Learning Goals Describe the steal and force buffer policies and explain how they affect a transaction s properties
More informationAtomicity: All actions in the Xact happen, or none happen. Consistency: If each Xact is consistent, and the DB starts consistent, it ends up
CRASH RECOVERY 1 REVIEW: THE ACID PROPERTIES Atomicity: All actions in the Xact happen, or none happen. Consistency: If each Xact is consistent, and the DB starts consistent, it ends up consistent. Isolation:
More informationTransaction Management: Crash Recovery (Chap. 18), part 1
Transaction Management: Crash Recovery (Chap. 18), part 1 CS634 Class 17 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke ACID Properties Transaction Management must fulfill
More informationsome sequential execution crash! Recovery Manager replacement MAIN MEMORY policy DISK
ACID Properties Transaction Management: Crash Recovery (Chap. 18), part 1 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke CS634 Class 17 Transaction Management must fulfill
More informationDatabase Applications (15-415)
Database Applications (15-415) DBMS Internals- Part XIII Lecture 21, April 14, 2014 Mohammad Hammoud Today Last Session: Transaction Management (Cont d) Today s Session: Transaction Management (finish)
More informationCarnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Administrivia. Last Class. Faloutsos/Pavlo CMU /615
Carnegie Mellon Univ. Dept. of Computer Science 15-415/615 - DB Applications C. Faloutsos A. Pavlo Lecture#23: Crash Recovery Part 2 (R&G ch. 18) Administrivia HW8 is due Thurs April 24 th Faloutsos/Pavlo
More informationCSE 344 MARCH 9 TH TRANSACTIONS
CSE 344 MARCH 9 TH TRANSACTIONS ADMINISTRIVIA HW8 Due Monday Max Two Late days Exam Review Sunday: 5pm EEB 045 CASE STUDY: SQLITE SQLite is very simple More info: http://www.sqlite.org/atomiccommit.html
More informationCSE 344 MARCH 25 TH ISOLATION
CSE 344 MARCH 25 TH ISOLATION ADMINISTRIVIA HW8 Due Friday, June 1 OQ7 Due Wednesday, May 30 Course Evaluations Out tomorrow TRANSACTIONS We use database transactions everyday Bank $$$ transfers Online
More informationFinal Review. May 9, 2017
Final Review May 9, 2017 1 SQL 2 A Basic SQL Query (optional) keyword indicating that the answer should not contain duplicates SELECT [DISTINCT] target-list A list of attributes of relations in relation-list
More informationDatabase Recovery Techniques. DBMS, 2007, CEng553 1
Database Recovery Techniques DBMS, 2007, CEng553 1 Review: The ACID properties v A tomicity: All actions in the Xact happen, or none happen. v C onsistency: If each Xact is consistent, and the DB starts
More informationFinal Review. May 9, 2018 May 11, 2018
Final Review May 9, 2018 May 11, 2018 1 SQL 2 A Basic SQL Query (optional) keyword indicating that the answer should not contain duplicates SELECT [DISTINCT] target-list A list of attributes of relations
More informationARIES (& Logging) April 2-4, 2018
ARIES (& Logging) April 2-4, 2018 1 What does it mean for a transaction to be committed? 2 If commit returns successfully, the transaction is recorded completely (atomicity) left the database in a stable
More informationCAS CS 460/660 Introduction to Database Systems. Recovery 1.1
CAS CS 460/660 Introduction to Database Systems Recovery 1.1 Review: The ACID properties Atomicity: All actions in the Xact happen, or none happen. Consistency: If each Xact is consistent, and the DB starts
More informationTransaction Management Exercises KEY
Transaction Management Exercises KEY I/O and CPU activities can be and are overlapped to minimize (disk and processor) idle time and to maximize throughput (units of work per time unit). This motivates
More informationFinal Exam CSE232, Spring 97
Final Exam CSE232, Spring 97 Name: Time: 2hrs 40min. Total points are 148. A. Serializability I (8) Consider the following schedule S, consisting of transactions T 1, T 2 and T 3 T 1 T 2 T 3 w(a) r(a)
More informationCOMPSCI/SOFTENG 351 & 751. Strategic Exercise 5 - Solutions. Transaction Processing, Crash Recovery and ER Diagrams. (May )
COMPSCI/SOFTENG 351 & 751 Strategic Exercise 5 - Solutions Transaction Processing, Crash Recovery and ER Diagrams (May 23 2016) Exercise 1 : Multiple-Granularity Locking: Use the Database organization
More informationTransaction Processing. Introduction to Databases CompSci 316 Fall 2018
Transaction Processing Introduction to Databases CompSci 316 Fall 2018 2 Announcements (Thu., Nov. 29) Homework #4 due next Tuesday Project demos sign-up instructions emailed Early in-class demos a week
More informationPage 1. Goals of Todayʼs Lecture" Two Key Questions" Goals of Transaction Scheduling"
Goals of Todayʼs Lecture" CS162 Operating Systems and Systems Programming Lecture 19 Transactions, Two Phase Locking (2PL), Two Phase Commit (2PC)" Transaction scheduling Two phase locking (2PL) and strict
More informationTransactions and Concurrency Control
Transactions and Concurrency Control Transaction: a unit of program execution that accesses and possibly updates some data items. A transaction is a collection of operations that logically form a single
More informationDatabase Administration and Tuning
Department of Computer Science and Engineering 2012/2013 Database Administration and Tuning Lab 5 2nd semester In this lab class we will approach the following topics: 1. Important Concepts 1. Transaction
More informationPage 1. Goals of Today s Lecture" Two Key Questions" Goals of Transaction Scheduling"
Goals of Today s Lecture" CS162 Operating Systems and Systems Programming Lecture 19 Transactions, Two Phase Locking (2PL), Two Phase Commit (2PC)" Transaction scheduling Two phase locking (2PL) and strict
More informationPage 1. Goals of Today s Lecture. The ACID properties of Transactions. Transactions
Goals of Today s Lecture CS162 Operating Systems and Systems Programming Lecture 19 Transactions, Two Phase Locking (2PL), Two Phase Commit (2PC) Finish Transaction scheduling Two phase locking (2PL) and
More informationFinal Exam CSE232, Spring 97, Solutions
T1 Final Exam CSE232, Spring 97, Solutions Name: Time: 2hrs 40min. Total points are 148. A. Serializability I (8) Consider the following schedule S, consisting of transactions T 1, T 2 and T 3 r(a) Give
More informationTransaction Management
Transaction Management 1) Explain properties of a transaction? (JUN/JULY 2015) Transactions should posses the following (ACID) properties: Transactions should possess several properties. These are often
More informationTransaction Management and Concurrency Control. Chapter 16, 17
Transaction Management and Concurrency Control Chapter 16, 17 Instructor: Vladimir Zadorozhny vladimir@sis.pitt.edu Information Science Program School of Information Sciences, University of Pittsburgh
More informationConcurrency Control. Concurrency Control Ensures interleaving of operations amongst concurrent transactions result in serializable schedules
Concurrency Control Concurrency Control Ensures interleaving of operations amongst concurrent transactions result in serializable schedules How? transaction operations interleaved following a protocol
More informationDatabase System Concepts
Chapter 15+16+17: Departamento de Engenharia Informática Instituto Superior Técnico 1 st Semester 2010/2011 Slides (fortemente) baseados nos slides oficiais do livro c Silberschatz, Korth and Sudarshan.
More informationCAS CS 460/660 Introduction to Database Systems. Transactions and Concurrency Control 1.1
CAS CS 460/660 Introduction to Database Systems Transactions and Concurrency Control 1.1 Recall: Structure of a DBMS Query in: e.g. Select min(account balance) Database app Data out: e.g. 2000 Query Optimization
More informationTransaction Processing: Concurrency Control. Announcements (April 26) Transactions. CPS 216 Advanced Database Systems
Transaction Processing: Concurrency Control CPS 216 Advanced Database Systems Announcements (April 26) 2 Homework #4 due this Thursday (April 28) Sample solution will be available on Thursday Project demo
More informationReview. Review. Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Lecture #21: Concurrency Control (R&G ch.
Carnegie Mellon Univ. Dept. of Computer Science 15-415/615 - DB Applications Lecture #21: Concurrency Control (R&G ch. 17) Review DBMSs support ACID Transaction semantics. Concurrency control and Crash
More informationL i (A) = transaction T i acquires lock for element A. U i (A) = transaction T i releases lock for element A
Lock-Based Scheduler Introduction to Data Management CSE 344 Lecture 20: Transactions Simple idea: Each element has a unique lock Each transaction must first acquire the lock before reading/writing that
More informationCS122 Lecture 19 Winter Term,
CS122 Lecture 19 Winter Term, 2014-2015 2 Dirty Page Table: Last Time: ARIES Every log entry has a Log Sequence Number (LSN) associated with it Every data page records the LSN of the most recent operation
More informationIntroduction to Data Management CSE 414
Introduction to Data Management CSE 414 Lecture 23: Transactions CSE 414 - Winter 2014 1 Announcements Webquiz due Monday night, 11 pm Homework 7 due Wednesday night, 11 pm CSE 414 - Winter 2014 2 Where
More informationCrash Recovery CMPSCI 645. Gerome Miklau. Slide content adapted from Ramakrishnan & Gehrke
Crash Recovery CMPSCI 645 Gerome Miklau Slide content adapted from Ramakrishnan & Gehrke 1 Review: the ACID Properties Database systems ensure the ACID properties: Atomicity: all operations of transaction
More informationProblems Caused by Failures
Problems Caused by Failures Update all account balances at a bank branch. Accounts(Anum, CId, BranchId, Balance) Update Accounts Set Balance = Balance * 1.05 Where BranchId = 12345 Partial Updates - Lack
More informationCSEP 544: Lecture 07. Transactions Part 2: Concurrency Control. CSEP544 - Fall
CSEP 544: Lecture 07 Transactions Part 2: Concurrency Control CSEP544 - Fall 2015 1 Announcements Homework 4 due next Tuesday Simple for you, but reflect on TXNs Rest of the quarter (revised!): Today:
More informationLock-based Concurrency Control
Lock-based oncurrency ontrol Self Study Materials hapter 16 : oncurrency ontrol A DBMS must ensure Only serializable (and recoverable) schedules are allowed, and no actions of committed transaction is
More informationConcurrency Control & Recovery
Transaction Management Overview CS 186, Fall 2002, Lecture 23 R & G Chapter 18 There are three side effects of acid. Enhanced long term memory, decreased short term memory, and I forget the third. - Timothy
More informationTransaction Management Overview
Transaction Management Overview Chapter 16 CSE 4411: Database Management Systems 1 Transactions Concurrent execution of user programs is essential for good DBMS performance. Because disk accesses are frequent,
More informationCS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #17: Transac0ons 2: 2PL and Deadlocks
CS 4604: Introduc0on to Database Management Systems B. Aditya Prakash Lecture #17: Transac0ons 2: 2PL and Deadlocks Review (last lecture) DBMSs support ACID Transac0on seman0cs. Concurrency control and
More informationDatabase Systems CSE 414
Database Systems CSE 414 Lecture 27: Transaction Implementations 1 Announcements Final exam will be on Dec. 14 (next Thursday) 14:30-16:20 in class Note the time difference, the exam will last ~2 hours
More informationIntroduction to Database Systems CSE 444
Introduction to Database Systems CSE 444 Lectures 11-12 Transactions: Recovery (Aries) 1 Readings Material in today s lecture NOT in the book Instead, read Sections 1, 2.2, and 3.2 of: Michael J. Franklin.
More information2 nd Semester 2009/2010
Chapter 16: Concurrency Control Departamento de Engenharia Informática Instituto Superior Técnico 2 nd Semester 2009/2010 Slides baseados nos slides oficiais do livro Database System Concepts c Silberschatz,
More informationGoal of Concurrency Control. Concurrency Control. Example. Solution 1. Solution 2. Solution 3
Goal of Concurrency Control Concurrency Control Transactions should be executed so that it is as though they executed in some serial order Also called Isolation or Serializability Weaker variants also
More informationOverview of Transaction Management
Overview of Transaction Management Chapter 16 Comp 521 Files and Databases Fall 2010 1 Database Transactions A transaction is the DBMS s abstract view of a user program: a sequence of database commands;
More informationCSE 544 Principles of Database Management Systems. Fall 2016 Lectures Transactions: recovery
CSE 544 Principles of Database Management Systems Fall 2016 Lectures 17-18 - Transactions: recovery Announcements Project presentations next Tuesday CSE 544 - Fall 2016 2 References Concurrency control
More informationDatabase Management Systems CSEP 544. Lecture 9: Transactions and Recovery
Database Management Systems CSEP 544 Lecture 9: Transactions and Recovery CSEP 544 - Fall 2017 1 HW8 released Announcements OH tomorrow Always check the class schedule page for up to date info Last lecture
More informationTransaction Management Overview. Transactions. Concurrency in a DBMS. Chapter 16
Transaction Management Overview Chapter 16 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Transactions Concurrent execution of user programs is essential for good DBMS performance. Because
More informationIntro to Transaction Management
Intro to Transaction Management CMPSCI 645 May 3, 2006 Gerome Miklau Slide content adapted from Ramakrishnan & Gehrke, Zack Ives 1 Concurrency Control Concurrent execution of user programs is essential
More informationLock Granularity and Consistency Levels (Lecture 7, cs262a) Ali Ghodsi and Ion Stoica, UC Berkeley February 7, 2018
Lock Granularity and Consistency Levels (Lecture 7, cs262a) Ali Ghodsi and Ion Stoica, UC Berkeley February 7, 2018 Papers Granularity of Locks and Degrees of Consistency in a Shared Database, J. N. Gray,
More informationIntroduction to Data Management. Lecture #26 (Transactions, cont.)
Introduction to Data Management Lecture #26 (Transactions, cont.) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v HW and exam
More informationLecture 16: Transactions (Recovery) Wednesday, May 16, 2012
Lecture 16: Transactions (Recovery) Wednesday, May 16, 2012 CSE544 - Spring, 2012 1 Announcements Makeup lectures: Friday, May 18, 10:30-11:50, CSE 405 Friday, May 25, 10:30-11:50, CSE 405 No lectures:
More informationCMSC 424 Database design Lecture 22 Concurrency/recovery. Mihai Pop
CMSC 424 Database design Lecture 22 Concurrency/recovery Mihai Pop Admin Signup sheet for project presentations Recap...1 ACID properties: Atomicity (recovery) Consistency (transaction design,, concurrency
More informationConflict Equivalent. Conflict Serializability. Example 1. Precedence Graph Test Every conflict serializable schedule is serializable
Conflict Equivalent Conflict Serializability 34 35 Outcome of a schedule depends on the order of conflicting operations Can interchange non-conflicting ops without changing effect of the schedule If two
More informationWhat are Transactions? Transaction Management: Introduction (Chap. 16) Major Example: the web app. Concurrent Execution. Web app in execution (CS636)
What are Transactions? Transaction Management: Introduction (Chap. 16) CS634 Class 14, Mar. 23, 2016 So far, we looked at individual queries; in practice, a task consists of a sequence of actions E.g.,
More informationTransactions. Kathleen Durant PhD Northeastern University CS3200 Lesson 9
Transactions Kathleen Durant PhD Northeastern University CS3200 Lesson 9 1 Outline for the day The definition of a transaction Benefits provided What they look like in SQL Scheduling Transactions Serializability
More informationConcurrency Control & Recovery
Transaction Management Overview R & G Chapter 18 There are three side effects of acid. Enchanced long term memory, decreased short term memory, and I forget the third. - Timothy Leary Concurrency Control
More informationAC61/AT61 DATABASE MANAGEMENT SYSTEMS JUNE 2013
Q2 (a) With the help of examples, explain the following terms briefly: entity set, one-to-many relationship, participation constraint, weak entity set. Entity set: A collection of similar entities such
More informationTransaction Management: Introduction (Chap. 16)
Transaction Management: Introduction (Chap. 16) CS634 Class 14 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke What are Transactions? So far, we looked at individual queries;
More informationdoc. RNDr. Tomáš Skopal, Ph.D.
course: Database Systems (NDBI025) SS2011/12 doc. RNDr. Tomáš Skopal, Ph.D. Department of Software Engineering, Faculty of Mathematics and Physics, Charles University in Prague motivation and the ACID
More informationChapter 17: Recovery System
Chapter 17: Recovery System! Failure Classification! Storage Structure! Recovery and Atomicity! Log-Based Recovery! Shadow Paging! Recovery With Concurrent Transactions! Buffer Management! Failure with
More informationFailure Classification. Chapter 17: Recovery System. Recovery Algorithms. Storage Structure
Chapter 17: Recovery System Failure Classification! Failure Classification! Storage Structure! Recovery and Atomicity! Log-Based Recovery! Shadow Paging! Recovery With Concurrent Transactions! Buffer Management!
More informationDatabase transactions
lecture 10: Database transactions course: Database Systems (NDBI025) doc. RNDr. Tomáš Skopal, Ph.D. SS2011/12 Department of Software Engineering, Faculty of Mathematics and Physics, Charles University
More informationReferences. Transaction Management. Database Administration and Tuning 2012/2013. Chpt 14 Silberchatz Chpt 16 Raghu
Database Administration and Tuning 2012/2013 Transaction Management Helena Galhardas DEI@Técnico DMIR@INESC-ID Chpt 14 Silberchatz Chpt 16 Raghu References 1 Overall DBMS Structure Transactions Transaction
More informationDatabase Recovery. Lecture #21. Andy Pavlo Computer Science Carnegie Mellon Univ. Database Systems / Fall 2018
Database Recovery Lecture #21 Database Systems 15-445/15-645 Fall 2018 AP Andy Pavlo Computer Science Carnegie Mellon Univ. 2 CRASH RECOVERY Recovery algorithms are techniques to ensure database consistency,
More informationCSE 444: Database Internals. Lectures 13 Transaction Schedules
CSE 444: Database Internals Lectures 13 Transaction Schedules CSE 444 - Winter 2018 1 About Lab 3 In lab 3, we implement transactions Focus on concurrency control Want to run many transactions at the same
More informationTransaction Overview and Concurrency Control
Transaction Overview and Concurrency Control CSC 375 Fall 2017, Chapters 16 & 17 There are three side effects of acid. Enhanced long term memory, decreased short term memory, and I forget the third. -
More informationAries (Lecture 6, cs262a)
Aries (Lecture 6, cs262a) Ali Ghodsi and Ion Stoica, UC Berkeley February 5, 2018 (based on slide from Joe Hellerstein and Alan Fekete) Today s Paper ARIES: A Transaction Recovery Method Supporting Fine-Granularity
More informationWarmGup#Exercise# CS#133:#Databases# TwoGPhase#Locking#(2PL)# Goals#for#Today#
WarmGupExercise CS133:Databases Spring2017 Lec17 3/23 Transac:ons Prof.BethTrushkowsky (Seeexercisesheet.Youcanstartbeforeclass.) YesS1andS2areconflictGequivalent. Noneitherisconflictserializable. GoalsforToday
More informationCS186 Final Exam Spring 2016
Name: Account: CS186 - CS186 Final Exam Spring 2016 You should receive 1 double-sided answer sheet and a 21-page exam. There are a total of 147 Points. Mark your name and login on both sides of the answer
More informationThe University of British Columbia Computer Science 304 Practice Final Examination
The University of British Columbia Computer Science 304 Practice Final Examination Instructor: Time: 2.5 hours Total marks: 100 Name (PRINT) (Last) (First) Signature This examination has 13 pages. Check
More informationCompSci 516 Database Systems
CompSci 516 Database Systems Lecture 17 Transactions Recovery (ARIES) Instructor: Sudeepa Roy Duke CS, Fall 2017 CompSci 516: Database Systems 1 Announcements Midterm report due on Wednesday, 11/01 HW3
More informationTransactions Processing (i)
ICS 321 Spring 2012 Transactions Processing (i) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 03/07/2012 Lipyeow Lim -- University of Hawaii at Manoa 1
More informationTopics in Reliable Distributed Systems
Topics in Reliable Distributed Systems 049017 1 T R A N S A C T I O N S Y S T E M S What is A Database? Organized collection of data typically persistent organization models: relational, object-based,
More informationDatabase Management System 21 Concurrency Control
Concurrency Database Management System 21 Concurrency School of Computer Engineering, KIIT University 21.1 Concurrency Lost Update Problem This problem occurs when two transactions that access the same
More informationDatabase Systems CSE 414
Database Systems CSE 414 Lecture 22: Transaction Implementations CSE 414 - Spring 2017 1 Announcements WQ7 (last!) due on Sunday HW7: due on Wed, May 24 using JDBC to execute SQL from Java using SQL Server
More informationHomework 7: Transactions, Logging and Recovery (due April 22nd, 2015, 4:00pm, in class hard-copy please)
Virginia Tech. Computer Science CS 4604 Introduction to DBMS Spring 2015, Prakash Homework 7: Transactions, Logging and Recovery (due April 22nd, 2015, 4:00pm, in class hard-copy please) Reminders: a.
More informationCS/B.Tech/CSE/New/SEM-6/CS-601/2013 DATABASE MANAGEMENENT SYSTEM. Time Allotted : 3 Hours Full Marks : 70
CS/B.Tech/CSE/New/SEM-6/CS-601/2013 2013 DATABASE MANAGEMENENT SYSTEM Time Allotted : 3 Hours Full Marks : 70 The figures in the margin indicate full marks. Candidates are required to give their answers
More informationIntroduction to Data Management. Lecture #18 (Transactions)
Introduction to Data Management Lecture #18 (Transactions) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v Project info: Part
More informationmywbut.com Concurrency Control
C H A P T E R 1 6 Concurrency Control This chapter describes how to control concurrent execution in a database, in order to ensure the isolation properties of transactions. A variety of protocols are described
More informationTransaction Processing: Concurrency Control ACID. Transaction in SQL. CPS 216 Advanced Database Systems. (Implicit beginning of transaction)
Transaction Processing: Concurrency Control CPS 216 Advanced Database Systems ACID Atomicity Transactions are either done or not done They are never left partially executed Consistency Transactions should
More informationCS122 Lecture 18 Winter Term, All hail the WAL-Rule!
CS122 Lecture 18 Winter Term, 2014-2015 All hail the WAL-Rule! 2 Write- Ahead Logging Last time, introduced write- ahead logging (WAL) as a mechanism to provide atomic, durable transactions Log records:
More information