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

Similar documents
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

Transactions and Concurrency Control

Final Exam CSE232, Spring 97

Final Exam CSE232, Spring 97, Solutions

Introduction to Query Processing and Query Optimization Techniques. Copyright 2011 Ramez Elmasri and Shamkant Navathe

CS 245 Midterm Exam Winter 2014

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

Algorithms for Query Processing and Optimization. 0. Introduction to Query Processing (1)

Lecture Query evaluation. Combining operators. Logical query optimization. By Marina Barsky Winter 2016, University of Toronto

Query Optimization. Query Optimization. Optimization considerations. Example. Interaction of algorithm choice and tree arrangement.

CSE 444: Database Internals. Lectures Transactions

CSE 344 MARCH 9 TH TRANSACTIONS

CSE 344 MARCH 25 TH ISOLATION

Introduction to Data Management CSE 414

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

Principles of Database Management Systems

Final Review. May 9, 2017

Final Review. May 9, 2018 May 11, 2018

TRANSACTION PROCESSING CONCEPTS

Chapter 3. Algorithms for Query Processing and Optimization

CMSC424: Database Design. Instructor: Amol Deshpande

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

External Sorting Implementing Relational Operators

Lassonde School of Engineering Winter 2016 Term Course No: 4411 Database Management Systems

Database Management Systems Paper Solution

Database Management Systems Written Exam

Optimization Overview

Database System Concepts

Chapter 13: Transactions

Babu Banarasi Das National Institute of Technology and Management

The query processor turns user queries and data modification commands into a query plan - a sequence of operations (or algorithm) on the database

CSE 444: Database Internals. Lectures 13 Transaction Schedules

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

CSE 190D Spring 2017 Final Exam Answers

Transaction Management. Chapter 14

University of Waterloo Midterm Examination Solution

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

Introduction to Data Management CSE 344

Topics in Reliable Distributed Systems

Chapter 9: Transactions

Outline. Query Processing Overview Algorithms for basic operations. Query optimization. Sorting Selection Join Projection

UNIT-IV TRANSACTION PROCESSING CONCEPTS

CS 564 Final Exam Fall 2015 Answers

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Database Systems: Fall 2008 Quiz I

Query Evaluation and Optimization

Database Management Systems 2010/11

Database Systems CSE 414

Query Processing. Introduction to Databases CompSci 316 Fall 2017

Lecture 20: Query Optimization (2)

Database Management Systems

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

Introduction to Transaction Management

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

CS322: Database Systems Transactions

Database Recovery. Dr. Bassam Hammo

Question 1 (a) 10 marks

CSE 444: Database Internals. Lecture 11 Query Optimization (part 2)

QUERY OPTIMIZATION. CS 564- Spring ACKs: Jeff Naughton, Jignesh Patel, AnHai Doan

DATABASE DESIGN I - 1DL300

CS 245 Midterm Exam Solution Winter 2015

Transactions. Silberschatz, Korth and Sudarshan

Transaction Management & Concurrency Control. CS 377: Database Systems

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

Checkpoints. Logs keep growing. After every failure, we d have to go back and replay the log. This can be time consuming. Checkpoint frequently

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

The Extended Algebra. Duplicate Elimination. Sorting. Example: Duplicate Elimination

Database System Concepts

Database Systems CSE 414

Introduction to Data Management CSE 344

Query Processing and Advanced Queries. Query Optimization (4)

mywbut.com Concurrency Control

Reminders. Query Optimizer Overview. The Three Parts of an Optimizer. Dynamic Programming. Search Algorithm. CSE 444: Database Internals

CS377: Database Systems Concurrency Control. Li Xiong Department of Mathematics and Computer Science Emory University

Advanced Databases (SE487) Prince Sultan University College of Computer and Information Sciences. Dr. Anis Koubaa. Spring 2014

Chapter 14: Transactions

Chapter 12: Query Processing. Chapter 12: Query Processing

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

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Database Management Systems (COP 5725) Homework 3

Database System Concepts

6.830 Problem Set 3 Assigned: 10/28 Due: 11/30

CHAPTER: TRANSACTIONS

Roadmap of This Lecture

Query Processing: The Basics. External Sorting

Lock Granularity and Consistency Levels (Lecture 7, cs262a) Ali Ghodsi and Ion Stoica, UC Berkeley February 7, 2018

Chapter 15: Transactions

Transaction Concept. Two main issues to deal with:

Introduction to Transaction Management

Faloutsos 1. Carnegie Mellon Univ. Dept. of Computer Science Database Applications. Outline

Database Management System 20

L22: The Relational Model (continued) CS3200 Database design (sp18 s2) 4/5/2018

Database Administration and Tuning

Relational Query Optimization

Implementing Relational Operators: Selection, Projection, Join. Database Management Systems, R. Ramakrishnan and J. Gehrke 1

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

Overview of Implementing Relational Operators and Query Evaluation

Statistics. Duplicate Elimination

PARALLEL & DISTRIBUTED DATABASES CS561-SPRING 2012 WPI, MOHAMED ELTABAKH

Chapter 12: Query Processing

CSE 344 MARCH 5 TH TRANSACTIONS

Transcription:

Name: Problem 1 Consider the following two transactions: T0: read(a); read(b); if (A = 0) then B = B + 1; write(b); T1: read(b); read(a); if (B = 0) then A = A + 1; write(a); Let the consistency requirement be (A = 0) OR (B = 0),with A = B = 0 the initial values (a) Show that every serial execution involving these two transactions preserves the consistency of the database. (b) Show a concurrent execution of T0 and T1 which produces a nonserializable schedule (c) Is there a concurrent execution of T0 and T1 which produces a serializable schedule? Prove why or why not.

Problem 2 Indicate whether each of the following is true or false. Explain why (unless it is already explicitly explained in the notes.) 1. Consider the merge join of R and S. The minimum memory requirement for the whole process is the square root of max( R, S ) blocks - ignoring constant factors that do not depend on the size of R and S. R and S stand for the sizes of the relations in blocks. 2. Consider the hash join of R and S. The minimum memory requirement for the whole process is the square root of max( R, S ) blocks - ignoring constant factors that do not depend on the size of R and S. 3. Checkpointing can significantly reduce recovery time when using UNDO logging. 4. If a schedule is not conflict serializable then it will definitely violate the consistency constraints of the database. 5. There are view serializable schedules that are not conflict serializable. 6. Two schedules with identical precedence graphs must be conflict equivalent.

7. In query optimization it is always better to perform projections as early as possible. 8. Sequential IOs are more expensive than random IOs. 9. When the sizes of join relations are big and we have indexes on the join attributes, the join index techique will outperform every other join technique we have seen. 10. A second level index for an indexed relation is usually dense. 11. Natural join is associative and commutative. 12. For queries of the form "SELECT A=a R" extensible hashing is better than B+ tree. 13. For queries of the form "SELECT A>a R" extensible hashing is better than B+ tree.

Problem 3 For each schedule below indicate whether the schedule is conflict serializable or not. If yes, provide the equivalent serial schedule. 1. w1(a),w2(b),w3(c),,r3(a),,r3(b) 2. w1(a),w2(b),w3(c),r3(a)r3(b) 3. r1(a),w2(a),w2(b),r1(b) 4. w1(a),w1(b),r2(a),w2(b),w1(c),r3(b),w3(c)

Problem 4 Consider a hash join with the following parameters: k: the number of buckets into which you will partition the relations m: the total amount of memory, in blocks. Remember that one of these blocks is used for reading the relations. s: the number of blocks for each relation (equal size) (a) How large does m need to be so that the first phase of the algorithm can run? (b) How large does m need to be so that the second phase can run? (c) Hybrid hash join is an optimization of hash join that keeps some of the buckets in memory during the "bucketizing" phase. Derive an equation that gives the maximum number of buckets that can be kept in memory when joining two relations. Introduce additional parameters to the ones above only if you feel it is absolutely necessary.

Problem 5 Consider the following schedule. Is it view serializable? Is it conflict serializable? For conflict serializability prove why or why not. w3(b),w3(a),w1(b),r2(b),r2(a),w1(a)

Problem 6 Let R(A,B,C) and S(C,D,E,F) be two relations. Transform the following relational algebra expression into an equivalent one in which selections and projections are performed as early as possible. Assume sets, not bags.) Please provide the answer in tree format. PROJECT B, F SELECT R.A=1 AND S.D=2 AND R.C=S.C R S

Problem 7 Consider B+ trees where the maximum number of values in a node is 2 (and the minimum is 1). Give an example of 3-level B+ tree that can be reorganized into a 2-level tree with exactly the same values. Display both the 3-level and the 2-level tree. Use letters or numbers for the values.

Problem 8 Construct the hypergraph for the following expression. SELECT R.A=W.A ((((((R(A,B) JOIN S(B,C,D)) JOIN T(B,E,F)) JOIN U(F,G,H)) JOIN V(G,I)) JOIN W(I,J,A)) Provide 4 left-deep algebraic expressions that do not involve cartesian products and compute the above.

Problem 9 Suppose we have relations R(A,B), with 1000000 tuples, and S(B,C), with 100000 tuples. Also assume that 20 of R's tuples fit in one block and 100 records of S fit in one block. Assume that there are 500 possible values for B. Each of the 500 values appears with equal probability in R and with equal probability in S. Assume the main memory is 1500 blocks. Compute the cost of the following, first assuming pipelining and then without assuming pipelining. (a) SELECT A=a (R S). Do not optimize the expression (say be pushing the selection down. Just estimate the cost of computing it.) (b) Sort-merge join for SELECT A=a (R JOIN S) assuming that the relations are not sorted. (c) Assuming indexes on R.B and S.B estimate the cost of join index. State assumptions you have made (other than the ones given by the problem). You do NOT have to provide answers for multiple sets of assumptions.

Problem 10 Is the following equation correct for sets? For sets with duplicates? Prove why or why not for each case. PROJECT attr (R-S) = (PROJECT attr R) - (PROJECT attr S)