Final Exam CSE232, Spring 97

Similar documents
Final Exam CSE232, Spring 97, Solutions

Transaction Management Overview

Problem 1 (12P) Indicate whether each of the following statements is true or false; explain briey. a) In query optimization, it is always better to pe

Transaction Management Overview. Transactions. Concurrency in a DBMS. Chapter 16

CSE 444: Database Internals. Lectures 13 Transaction Schedules

COURSE 1. Database Management Systems

Relational DBMS Internals Solutions Manual. A. Albano, D. Colazzo, G. Ghelli and R. Orsini

Administration Naive DBMS CMPT 454 Topics. John Edgar 2

Transactions and Concurrency Control

CSE 444: Database Internals. Lectures Transactions

CS 564 Final Exam Fall 2015 Answers

Transaction Management Exercises KEY

CSE 344 MARCH 9 TH TRANSACTIONS

CSE 190D Spring 2017 Final Exam

CPSC 310: Database Systems / CSPC 603: Database Systems and Applications Final Exam Fall 2005

Transaction Management and Concurrency Control. Chapter 16, 17

Transaction Management & Concurrency Control. CS 377: Database Systems

Concurrency Control! Snapshot isolation" q How to ensure serializability and recoverability? " q Lock-Based Protocols" q Other Protocols"

Name: Problem 1 Consider the following two transactions: T0: read(a); read(b); if (A = 0) then B = B + 1; write(b);

Introduction to Data Management CSE 344

Advanced Databases. Transactions. Nikolaus Augsten. FB Computerwissenschaften Universität Salzburg

Concurrency Control & Recovery

Overview of Transaction Management

Review. Review. Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Lecture #21: Concurrency Control (R&G ch.

Slides Courtesy of R. Ramakrishnan and J. Gehrke 2. v Concurrent execution of queries for improved performance.

CSE 344 MARCH 25 TH ISOLATION

Introduction to Data Management CSE 344

Database Administration and Tuning

CSE 190D Spring 2017 Final Exam Answers

CISC437/637 Database Systems Final Exam

CISC437/637 Database Systems Final Exam

L i (A) = transaction T i acquires lock for element A. U i (A) = transaction T i releases lock for element A

CS322: Database Systems Transactions

Transaction Processing. Introduction to Databases CompSci 316 Fall 2018

CSE 344 MARCH 5 TH TRANSACTIONS

References. Transaction Management. Database Administration and Tuning 2012/2013. Chpt 14 Silberchatz Chpt 16 Raghu

Final Review. May 9, 2017

Final Review. May 9, 2018 May 11, 2018

Introduction to Transaction Management

CHAPTER: TRANSACTIONS

Database Systems CSE 414

Intro to Transaction Management

Chapter 9: Transactions

INSTITUTO SUPERIOR TÉCNICO Administração e optimização de Bases de Dados

Transactions. Transaction. Execution of a user program in a DBMS.

CS 5614: Transaction Processing 121. Transaction = Unit of Work Recall ACID Properties (from Module 1)

Final Review. CS634 May 11, Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke

Announcements. Motivating Example. Transaction ROLLBACK. Motivating Example. CSE 444: Database Internals. Lab 2 extended until Monday

Transaction Processing: Concurrency Control. Announcements (April 26) Transactions. CPS 216 Advanced Database Systems

Intro to Transactions

Including Aborts in Serializability. Conflict Serializable Schedules. Recall Conflicts. Conflict Equivalent

Database Management Systems CSEP 544. Lecture 9: Transactions and Recovery

Roadmap of This Lecture

Lecture 12. Lecture 12: The IO Model & External Sorting

Concurrency Control & Recovery

Fundamentals of Database Systems

CSE 444, Winter 2011, Midterm Examination 9 February 2011

Announcements. Transaction. Motivating Example. Motivating Example. Transactions. CSE 444: Database Internals

Database Management System

Page 1. CS194-3/CS16x Introduction to Systems. Lecture 8. Database concurrency control, Serializability, conflict serializability, 2PL and strict 2PL

14.1 Answer: 14.2 Answer: 14.3 Answer: 14.4 Answer:

Lecture 20 Transactions

Database System Concepts

Lectures 8 & 9. Lectures 7 & 8: Transactions

Last time: Saw how to implement atomicity in the presence of crashes, but only one transaction running at a time

Chapter 14: Transactions

Database Management Systems Written Examination

Final Review. CS 145 Final Review. The Best Of Collection (Master Tracks), Vol. 2

CSE 344 MARCH 21 ST TRANSACTIONS

Introduction to Data Management. Lecture #26 (Transactions, cont.)

Database Systems CSE 414

Introduction to Data Management CSE 414

Assignment 6 Solutions

Goal of Concurrency Control. Concurrency Control. Example. Solution 1. Solution 2. Solution 3

CSC 261/461 Database Systems Lecture 21 and 22. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101

Chapter 15: Transactions

Transaction Concept. Two main issues to deal with:

Database Management Systems 2010/11

Topics in Reliable Distributed Systems

Introduction TRANSACTIONS & CONCURRENCY CONTROL. Transactions. Concurrency

Transactions. Kathleen Durant PhD Northeastern University CS3200 Lesson 9

Introduction. Storage Failure Recovery Logging Undo Logging Redo Logging ARIES

Transaction Management: Concurrency Control

Conflict Equivalent. Conflict Serializability. Example 1. Precedence Graph Test Every conflict serializable schedule is serializable

The transaction. Defining properties of transactions. Failures in complex systems propagate. Concurrency Control, Locking, and Recovery

Examples of Physical Query Plan Alternatives. Selected Material from Chapters 12, 14 and 15

Transactions. Lecture 8. Transactions. ACID Properties. Transaction Concept. Example of Fund Transfer. Example of Fund Transfer (Cont.

What are Transactions? Transaction Management: Introduction (Chap. 16) Major Example: the web app. Concurrent Execution. Web app in execution (CS636)

CS122 Lecture 19 Winter Term,

Transaction Processing: Concurrency Control ACID. Transaction in SQL. CPS 216 Advanced Database Systems. (Implicit beginning of transaction)

Database Management System

Homework 5 (by Joy Arulraj) Due: Monday Nov 13, 11:59pm

Transaction Management: Introduction (Chap. 16)

Introduction to Data Management. Lecture #18 (Transactions)

Serializability of global history

Chapter 14: Transactions

User Perspective. Module III: System Perspective. Module III: Topics Covered. Module III Overview of Storage Structures, QP, and TM

Page 1. Goals of Today s Lecture. The ACID properties of Transactions. Transactions

Database System Concepts

Concurrency Control. Chapter 17. Comp 521 Files and Databases Spring

Transcription:

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) w(a) r(b) r(b) Give the precedence graph for S Is S conflict serializable? Justify your answer. Is S view serializable? Justify your answer.

B. Serializability II (15) Two transactions are not interleaved in a schedule S if every operation of one transaction precedes every operation of the other. (Note, the schedule may not be serial.) Give an example of a serializable schedule S that has all of the following properties: transactions T 1 and T 2 are not interleaved in S T 1 starts before T 2 in S in any serial schedule equivalent to S, T 2 precedes T 1 Hint: The schedule may include more than two transactions.

C. Serializability III (15) Consider two non-identical schedules S and S consisting of transactions T 1,, T n where n>1. For each of the following set of conditions decide whether S and S have to be equivalent, have to be nonequivalent, is impossible to decide whether they are equivalent or not using the given conditions the described conditions can not hold The conditions are 1. S only reads, S and S are serial and n=2 2. All transactions T 1,, T n write a specific item A exactly once and S and S are serial. 3. The precedence graphs of S and S are identical and acyclic. 4. S is serializable but S is not serializable. 5. No two serial schedules (of T 1,, T n ) are equivalent and S and S are serializable. 1 2 3 4 5 equivalent nonequivalent impossible to decide can not hold

D. Two Phase Lock (20) For each one of the following schedules decide whether they are serializable they can be produced by a Two Phase Lock (2PL) scheduler they can be produced by a strict 2PL scheduler and check in the table below all entries that apply. Justify your answers in a concrete way. For example, if a schedule is 2PL show a series of lock/unlock operations that are compatible with the 2PL rules (you can use the empty lines of the schedules to place lock/unlock operations.) Answers of the form it is serializable because I can see that I can swap the operations will not get full credit. Assume that shared locks can be used if in this way you can make a schedule 2PL or strict 2PL. T 1 T 2 T 3 r(d) w(a) r(b) w(d) r(d) T 1 T 2 T 3 w(a) r(b) w(d) r(d) w(d)

T 1 T 2 T 3 r(d) w(a) r(b) r(d) w(d) 1 2 3 serializable 2PL Strict 2PL

E. Recovery I (10) 1. Undo logging requires that before an item X is modified on disk the log records pertaining to X are in the disk. (This is the WAL rule.) Show using an example that an inconsistent database may result if log records for X are not output to the disk before X. 2. Redo logging: Show using an example that an inconsistent database may result if some items are written on the disk before the commit is written on the log, even if WAL holds. 3. Undo logging: Show using an example that an inconsistent database may result if some items are not written in the disk by the time the commit is written. Assume that WAL holds. Your examples should involve a crash and should clearly show (I) the write actions of the transaction, (II) the state of the log and the database at the time of the crash, and (III) why successful recovery can not be accomplished.

F. Recovery II (20) We know that non strict 2PL may cause cascading aborts. Even worse, it could be the case that a crash occurs while cascading aborts take place. The goal of this exercise is to develop an Undo logging system that can handle cascading aborts, i.e., upon restart it can abort the transactions that have to be aborted and so on. 1. What additions are needed in the Undo logging data for handling cascading aborts 2. Write the rules of your enhanced cascading abort Undo logging (in the spirit of the notes). Try to pose rules that are not very restrictive. 3. Write an algorithm for recovery (restart) using notation similar with the notes. Clarification on notes: In the slide of Undo Logging Recovery the condition NO <T, Commit> (or <T, Abort>) in log is parenthesized as (NO <T, Commit>) OR <T, Abort> in log.

G. Recovery III (18) Consider a transaction that performs the following actions in the given order 1. Write object A 2. Write object B 3. Commit Decide whether each one of the following snapshots of the database and the log are possible or impossible at any point during or after the end of the transaction. The snapshots refer to data that are actually in the disk. Assume that if we do not mention explicitly that something is stored on the disk then it is not stored on the disk. For each item give an answer for both Undo and Redo logging. 1. Log has entry for write(a) and the database has the new value of A 2. The database has the new value for A 3. The log has entries for write(a) and write(b) and also has the commit entry 4. The log has entries for write(a) and write(b). The database has the new values for A and B 5. The log has entries for write(a), write(b), and the commit entry. The database has the new value for A 6. Log has entry for write(a) and commit and the database has the new value of A 1 2 3 4 5 6 UNDO possible LOGGING impossible 1 2 3 4 5 6 REDO possible LOGGING impossible

H. Query Processing I (20) Can it be worthwhile to temporarily create an index (B-tree index, hash table index,...) to speed up the cost of executing a query? That is, does it make sense during the query execution to create an index that is discarded at the end of the query? If your answer is no discuss why other alternatives (nested loops, merge join, or hash join) will always be better. If your answer is "yes", give an example, including statistics and rough cost estimates, that shows that the index join (with index creation) is cheaper than nested loops or hash join. You may assume that merge join is too expensive if the relations are not sorted.

I. Query Processing II (22).Consider the following query: SELECT * FROM R, S, T WHERE R.A = S.A and R.B = T.B AND T.C = S.C AND R.D = 16 AND S.F = 17 1. Give six algebraic expressions that (I) contain no cartesian product, (II) have pushed selections down, (III) each join is associated with an atomic condition (not a conjunctive condition). 2. Find the optimum plan, i.e., an algebraic expression where selections and projections are annotated with execution primitives. The execution primitives are SCAN and INDEX for the selection operator and LOOPS, INDEX, MERGE, and HASH for join. Compute an estimation of the optimal plan s cost. Assume the following schemas and statistics for the relations. R(A, B, D, E) has 1 million tuples, an index on D, V(D,R)=1000, V(A,R)=1000000, V(B,R)=1000000. S(A, C, F, G) has 1 million tuples, an index on F, V(F,S)=1000, V(A,S)=1000000, and V(C,S)=1000000 T(B, C, H, I) has 1 million tuples, an index on B, with V(B,T)=1000000, V(C,T)=1000000. Assume the block size is 4096 Bytes, the block header size is 96 bytes, each indexed attribute occupies 5 bytes and the tuple size of each relation is 80 bytes. To estimate the size of the joins use the following information: For every tuple of R there is exactly one tuple of S with the same A value and one tuple of T with the same B value. Equivalently, the chances that a given S tuple joins a given R tuple are 1/1000000. For every tuple of S there is exactly one tuple of R with the same A value and one tuple of T with the same C value. For every tuple of T there is exactly one tuple of R with the same B value and one tuple of S with the same B value. Assume there is one megabyte of main memory available. Hint: You should use the main memory to avoid copying intermediate results to the disk, if there is enough space in main memory.