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

Size: px
Start display at page:

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

Transcription

1 INSTITUTO SUPERIOR TÉCNICO Administração e optimização de Bases de Dados Exam 1 - solution 16 June The duration of this exam is 2,5 Hours. You can access your own written materials, but the exam is to be done individually. You are not allowed to use computers, tablets, nor mobile phones. The maximum grade of the exam is 20 pts. Write your answers below the questions. Write your number and name at the top of each page. Present all calculations performed. After the exam starts, you can leave the room one hour after delivering the exam. The following table is be used by instructors, ONLY: SUM

2 1. (4 vals) Indexing 1.1. (2,5 pts) Suppose that we are using extendable hashing on a file that contains records with the following search-key values: Search-key values Hash value Ronaldo Messi Hernandez Iniesta Lahm Ibrahimovic Rooney Neymar Show the extendable hash structure for this file, if the hash values for each search key are as shown in the table above, and if buckets can hold up to three records. Use the least significant bits of the hash value. 2

3 1.2. (1 pt) Suppose that you have a sorted file and want to construct a dense primary B+ tree index on this file. a) One way to accomplish this task is to scan the file, record by record, inserting each one using the B+ tree insertion procedure. What performance and storage utilization problems are there with this approach? b) Explain how the bulk-loading algorithm improves upon this scheme. a) This approach is likely to be quite expensive, since each entry requires us to start from the root and go down to the appropriate leaf page. Even though the index level pages are likely to stay in the buffer pool between successive requests, the overhead is still considerable. Also, according to the insertion algorithm, each time a node splits, the data entries are redistributed evenly to both nodes. This leads to a fixed page utilization of 50%. b) The bulk loading algorithm has good performance and space utilization compared with the repeated inserts approach. Since the B+ tree is grown from the bottom up, the bulk loading algorithm allows the administrator to pre-set the amount each index and data page should be filled. This allows good performance for future inserts, and supports some desired space utilization (0,5 pt) What is the difference between a B+-tree index and a B+-tree file organization? Indicate one advantage of the each schema. In a B+ tree file organization, the leaf nodes store records instead of pointers to records. B+ tree indices solve the problem of index file degradation while B+ tree file organization solves the data file degradation problem. 3

4 2. (4 pts) Query Processing and Optimization 2.1. (2,5 pts) Consider performing a natural join between the following two relations: Client(Name,ID) ClientDetails(ID,Property,Value) Assume that the Client tuples are stored contiguously on 2000 disk blocks and that the ClientDetails tuples are stored contiguously on 400 blocks. Each block of Client or ClientDetails holds up to 50 tuples. There are 102 memory blocks available. Compute the I/O cost for each of the following join algorithms, justifying your result. Ignore the I/O cost of writing the output to disk. Unless stated otherwise, the tuples in the relations are not sorted. a) Merge join, sorted relations (i.e., assume that both relations are sorted). b) Merge join, unsorted relations (i.e., assume that both relations are unsorted). c) Index join. Assume that there is an index on the ID column of Client. We read a block of ClientDetails and, for each tuple in this block, we use the index to find all matching tuples of Client. Each of these Client tuples is read into memory and joined with the tuples from ClientDetails. We repeat the process for all blocks of ClientDetails. Assume that the index is entirely in memory, and assume that, on average, each tuple of ClientDetails matches 4 tuples of Client. d) Hash join. Assume Client as the build relation. a) Cost merge join = bclient + bclientdetails = = 2400 b) Cost merge join + cost sorting Client + cost sorting ClientDetails Cost sorting Client = bclient(2*ceiling(log M-1 (bclient/m)) + 1) = = 2000 * (2*ceiling(log 101 (2000/102)) + 1) = = 2000 * (2*1 + 1) = 6000 Cost sorting ClientDetails = 400 * (2*ceiling(log 101 (400/102)) + 1) = = 400 * (2*1 + 1) = 1200 Cost = = 9600 c) bclientdetails + nbtuplesclientdetails * c, where c is the cost of a selection using an index c = h + b, where h is the height of the index, i.e., the number of blocks to go from the root until the leaves in this case, it is zero because the index is entirely in memory, so there is no need to transfer blocks from disk to memory. b is the number of blocks containing records with the specified search key, i.e. the number of Client tuples that match each ClientDetails tuple. nbtuplesclientdetails = 400 * 50 =

5 Cost = * 4 = d) bclient/m = 2000/102 = 19.6 < 102 so there is no need for partitioning Cost = 3* (bclientdetails + bclient) = 3 *( ) = (1 pt) Consider the following database relations: Client(Name,Address,ClientID) ClientSubcriptions(ClientID,SubscriptionType) ClientID: Foreign Key(Client) The relation Client has 200 tuples and the relation ClientSubscriptions has 600 tuples. Answer the following questions: a) Estimate the number of tuples of Client X ClientSubscriptions. b) Consider the selection: σ ClientID=2 (Client X ClientSubscriptions). Estimate the number of tuples returned by the selection. a) ClientID is primary key of Client and foreign key in ClientSubscriptions referencing Client, so the number of tuples in the result of the join is the same as the number of tuples in ClientSubscriptions = 600 b) σ ClientID=2(Client X ClientSubscriptions) = 600 / V(ClientID, Client X ClientSubscriptions) = 600/200 = (0,5 pt) What would change in the answer to question 2.2.b) if the selection condition was ClientID>2? The number of tuples would be n/2 =600/2 = 300 because we do not have any statistical information about the maximum and minimum values that the attribute ClientID can take. 5

6 3.(4 pts) Transactions and Concurrency Control 3.1. (2,5 pts) Consider a multi-granularity locking system, with lock modes IX, X, IS, S and SIX. The objects are arranged in the following hierarchy: relation / \ / \ block A block B / \ / \ / \ / \ a1 a2 a3 b1 b2 Assume there are two active transactions T1 and T2, and there are no lock upgrades. a) Transaction T1 has already obtained the following locks: IS lock on the relation, S on B. Transaction T2 wants to modify b2 (and nothing else) while T1 is active. What lock does T2 need to get? Which of these locks can T2 get at this point? b) Transaction T1 has already obtained the following locks: IS lock on the relation, S on A. Transaction T2 wants to read b2 and modify a1 (and nothing else) while T1 is active. What locks does T2 need to get? Which of these locks can T2 get at this point? c) Transaction T1 has already obtained the following locks: IX lock on the relation, IX on A, X on a1. Transaction T2 wants to read a2 and modify a3 (and nothing else) while T1 is active. What locks does T2 need to get? Which of these locks can T2 get at this point? d) Transaction T1 has already obtained the following locks: IX lock on the relation, IX on A, X on a1. Transaction T2 wants to read a2 and modify a1 (and nothing else) while T1 is active. What locks does T2 need to get? Which of these locks can T2 get at this point? a) T2 needs to get: IX(relation); IX(B); X(b2) Can get: IX(relation) b) T2 needs to get: IX(relation); IX(A); IS(B); X(a1), S(b2) Can get: IX(relation); IS(B); S(b2) c) T2 needs to get: IX(R); IX(A); S(a2); X(a3) Can get all d) T2 needs to get: IX(relation); IX(A); S(a2); X(a1) Can get all except X(a1) 6

7 3.2. (1 pt) Consider the following two transactions: T1: R1(X) W1(X) R1(Y) W1(Y) T2: R2(Y) W2(Y) Which of the following schedules would be allowed under the 2-Phase Locking protocol? Justify your answer. Assume that the L lock actions in the schedules are exclusive. a) L1(X) L1(Y) L2(Y) R1(X) W1(X) R1(Y) W1(Y) R2(Y) W(Y) U2(Y) U1(Y) U1(X) b) L1(Y) L1(X) R1(X) W1(X) R1(Y) W1(Y) U1(X) U1(Y) L2(Y) R2(Y) W2(Y) U2(Y) Schedule a) is not possible, because T2 can only get a lock on Y (L2(Y)) after T1 releases the lock it ot on Y. Schedule b) is possible because each transaction first obtains the locks and when it starts to release the locks, it does not obtain anymore (0,5 pt) Consider the following schedule for three concurrent transactions and indicate whether it is possible under the timestamp-based protocol. Justify. T1 T2 T R(A) R(C) W(A) W(B) W(B) W(C) If we consider TS(T1) < TS(T2) < TS(T3) When T2:W(A) TS(T2) < Read_TS(A) = TS(T3) so the operation is rejected and T2 is rolled back 7

8 4. (4 pts) Recovery Management 4.1. (2,5 pts) Briefly answer the following questions regarding the ARIES recovery algorithm: a) If the system fails repeatedly during recovery, what is the maximum number of log records that can be written (as a function of the number of update and other log records written before the crash) before restart completes successfully? Justify. b) What is the oldest log record we need to retain? Justify. a) Let us take the case where each log record is an update record of an uncommitted transaction and each record belongs to a different transaction. This means there are n records of n different transactions, each of which has to be undone. During recovery, we have to add a CLR record of the undone action and an end transaction record after each CLR. Thus, we can write a maximum of 2n log records before restart completes. b) The oldest begin checkpoint referenced in any fuzzy dump or master log record (1 pt) In the context of the ARIES algorithm, explain the purpose of the checkpoint mechanism. Explain how does the frequency of checkpoints affect: (i) The system's performance when no failure occurs. (ii) The time it takes to recover from a system crash. (iii) The time it takes to recover from a disk crash (i.e., a crash on stable storage). Checkpointing is done with log-based recovery schemes such as ARIES to reduce the time required for recovery after a crash. If there is no checkpointing, then the entire log must be searched after a crash, and all transactions have to be undone/redone from the log. If checkpointing had been performed, then most of the log-records prior to the checkpoint (i.e., those associated to committed transactions, that are already reflected in stable storage) can be ignored at the time of recovery. Another reason to perform checkpoints is to clear log-records from stable storage as it gets full. Since checkpoints cause some loss in performance while they are being taken (i.e., they decrease system performance when no failure occurs), their frequency should be reduced if fast recovery is not critical. If we need fast recovery from a system crash, checkpointing frequency should be increased. Checkpoints have no effect on recovery from a disk crash (i.e., the equivalent of checkpoints for recovery from disk crashes are the archival dumps). 8

9 4.3. (0,5 pt) How does the recovery manager ensure atomicity of transactions? How does it ensure durability? The Recovery Manager ensures atomicity of transactions by undoing the actions of transactions that do not commit. It ensures durability by making sure that all actions of committed transactions survive system crashes and media failures. 9

10 5. (4 pts) Miscellaneous 5.1. (1 pt) Discuss how the SQL Server DBMS supports data indexing, trying to answer the following particular questions: a) Are clustered indexes on non-key attributes supported? b) Are composite indexes supported? Besides composite indexes, is there any other way to implement the idea of "covering indexes" through non-clustered indexes? c) Can the non-clustered indexes be sparse, or do they have to be dense? d) How are tuple locators (i.e., the pointers to the actual tuples associated to the index keys) implemented in the case of non-clustered indexes (i.e., what is the relationship between clustered and non-clustered indexes)? e) Why should clustered index keys use as few columns as possible? a) In SQL Server 2012, one can create non-clustered indexes on a single attribute, or on multiple attributes of a given relation (i.e., composite indexes), which may be keys or not. b) Besides composite indexes, SQL Server also supports the idea of having several attributes, besides the index key, included in the leaves of the indexing structure. This is particularly useful for defining indexes that can cover all attributes involved in a particular query, thus avoiding the access to the actual tuples. c) As in all DBMS, non-clustered indexes have to be dense, so that each index key is associated to the corresponding "tuple locator". d) In SQL Server, the structure of the "tuple locators" depends on whether the data pages from the corresponding relation are stored in a heap or a clustered table (i.e., depending on whether the table has a clustered index or not). For a heap, a row locator is a pointer to the row. For a clustered table, the row locator is the clustered index key. e) In SQL Server, it is beneficial to define clustered index keys with as few columns as possible. If a large clustered index key is defined, any non-clustered indexes that are defined on the same table will be significantly larger, because the nonclustered index entries contain the clustering key (1 pt) Explain the two general strategies through which parallelism can be used in DBMS processing. Clearly indicate how DBMSs can make use of these two general strategies (i.e., what are the typical operations where each of the strategies can be employed). The two general strategies are pipeline parallelism (i.e., many machines each doing one step in a multi-step process) and partition parallelism (i.e., many machines doing the same thing to different pieces of data). Partitioning can be exploited in the context of intra-operator parallelism (e.g., get all machines working to compute a given operation, for instance a scan, a sort, or a join). Pipelining can be exploited in the context of inter-operator parallelism (e.g., each operator of a given complex query may run concurrently on a different site). 10

11 5.3.(1 pt) Consider a database storing information about the expenses and revenues associated to the employees of a given company, specifically (i) the monthly revenues generated by each employee, and (ii) the yearly salary for each employee. Consider also the following two equivalent SQL queries, which return the employees that are paid yearly the same value that they generate to the company in revenues: SELECT * FROM Employees WHERE salary = 12*revenue; SELECT * FROM Employees WHERE salary/12 = revenue; Explain which query is better (i.e., in which situations is one query better than the other, in terms of execution efficiency). Justify your answer. First, it is important to remember that even if there are indexes on a table, but the query has an algebraic expression in the corresponding index key, the index will likely not be used. With this in mind, we should try to use the query most likely to explore existing indexes. * If there is an index on one of the tables, then the query where the corresponding attribute is not using an arithmetic operation should be used. * If there are indexes on both tables, and if there's a clustering index on the larger table, we should try to use it. * If there are indexes on both tables, but only a non-clustering index on the larger table, then we should: (i) if the small table has (much) less records than the larger table has pages, then we should use use the non-clustering index on the large table; (ii) otherwise, we should use the index on the small table (1 pt) Explain the difference between a system crash and a "disaster." Indicate what kinds of strategies are used in database management systems for handling both types of problems. In a system crash, the CPU goes down and disk may also crash, but stable-storage at the site is assumed to survive system crashes. In a disaster, everything at a site is destroyed. Recovery algorithms such as ARIES are typically used in DBMSs for recovering from system crashes. For recovering from "disasters, stable storage needs to be distributed and, in the context of DBMSs, different types of backup strategies can also be used to recover from disasters. 11

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 -------------------------------------------------------------------------------------------------------------- INSTITUTO SUPERIOR TÉCNICO Administração e optimização de Bases de Dados Exam 1 16 June 2014

More information

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 -------------------------------------------------------------------------------------------------------------- INSTITUTO SUPERIOR TÉCNICO Administração e optimização de Bases de Dados Exam 1 - Solution

More information

Final Review. May 9, 2017

Final 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 information

Final Review. May 9, 2018 May 11, 2018

Final 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 information

6.830 Lecture Recovery 10/30/2017

6.830 Lecture Recovery 10/30/2017 6.830 Lecture 14 -- Recovery 10/30/2017 Have been talking about transactions Transactions -- what do they do? Awesomely powerful abstraction -- programmer can run arbitrary mixture of commands that read

More information

6.830 Lecture Recovery 10/30/2017

6.830 Lecture Recovery 10/30/2017 6.830 Lecture 14 -- Recovery 10/30/2017 Have been talking about transactions Transactions -- what do they do? Awesomely powerful abstraction -- programmer can run arbitrary mixture of commands that read

More information

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

6.830 Problem Set 3 Assigned: 10/28 Due: 11/30 6.830 Problem Set 3 1 Assigned: 10/28 Due: 11/30 6.830 Problem Set 3 The purpose of this problem set is to give you some practice with concepts related to query optimization and concurrency control and

More information

CS 245 Final Exam Winter 2016

CS 245 Final Exam Winter 2016 CS 245 Final Exam Winter 2016 This exam is open book and notes. You can use a calculator. You can use your laptop only to access CS245 materials. You have 140 minutes (2 hours, 20 minutes) to complete

More information

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

Concurrency Control. Chapter 17. Comp 521 Files and Databases Fall Concurrency Control Chapter 17 Comp 521 Files and Databases Fall 2012 1 Conflict Serializable Schedules Recall conflicts (WR, RW, WW) were the cause of sequential inconsistency Two schedules are conflict

More information

CS 564 Final Exam Fall 2015 Answers

CS 564 Final Exam Fall 2015 Answers CS 564 Final Exam Fall 015 Answers A: STORAGE AND INDEXING [0pts] I. [10pts] For the following questions, clearly circle True or False. 1. The cost of a file scan is essentially the same for a heap file

More information

IMPORTANT: Circle the last two letters of your class account:

IMPORTANT: Circle the last two letters of your class account: Spring 2011 University of California, Berkeley College of Engineering Computer Science Division EECS MIDTERM I CS 186 Introduction to Database Systems Prof. Michael J. Franklin NAME: STUDENT ID: IMPORTANT:

More information

What 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) 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 information

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

Concurrency Control. Chapter 17. Comp 521 Files and Databases Spring Concurrency Control Chapter 17 Comp 521 Files and Databases Spring 2010 1 Conflict Serializable Schedules Recall conflicts (WW, RW, WW) were the cause of sequential inconsistency Two schedules are conflict

More information

Concurrency Control. [R&G] Chapter 17 CS432 1

Concurrency Control. [R&G] Chapter 17 CS432 1 Concurrency Control [R&G] Chapter 17 CS432 1 Conflict Serializable Schedules Two schedules are conflict equivalent if: Involve the same actions of the same transactions Every pair of conflicting actions

More information

Concurrency Control. R &G - Chapter 19

Concurrency Control. R &G - Chapter 19 Concurrency Control R &G - Chapter 19 Smile, it is the key that fits the lock of everybody's heart. Anthony J. D'Angelo, The College Blue Book Review DBMSs support concurrency, crash recovery with: ACID

More information

Concurrency Control. Conflict Serializable Schedules. Example. Chapter 17

Concurrency Control. Conflict Serializable Schedules. Example. Chapter 17 Concurrency Control Chapter 17 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Conflict Serializable Schedules Two schedules are conflict equivalent if: Involve the same actions of the

More information

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

Goal 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 information

Transaction Management: Introduction (Chap. 16)

Transaction 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 information

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

Concurrency 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 information

CHAPTER 3 RECOVERY & CONCURRENCY ADVANCED DATABASE SYSTEMS. Assist. Prof. Dr. Volkan TUNALI

CHAPTER 3 RECOVERY & CONCURRENCY ADVANCED DATABASE SYSTEMS. Assist. Prof. Dr. Volkan TUNALI CHAPTER 3 RECOVERY & CONCURRENCY ADVANCED DATABASE SYSTEMS Assist. Prof. Dr. Volkan TUNALI PART 1 2 RECOVERY Topics 3 Introduction Transactions Transaction Log System Recovery Media Recovery Introduction

More information

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

User Perspective. Module III: System Perspective. Module III: Topics Covered. Module III Overview of Storage Structures, QP, and TM Module III Overview of Storage Structures, QP, and TM Sharma Chakravarthy UT Arlington sharma@cse.uta.edu http://www2.uta.edu/sharma base Management Systems: Sharma Chakravarthy Module I Requirements analysis

More information

Introduction. Storage Failure Recovery Logging Undo Logging Redo Logging ARIES

Introduction. 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 information

Heckaton. SQL Server's Memory Optimized OLTP Engine

Heckaton. SQL Server's Memory Optimized OLTP Engine Heckaton SQL Server's Memory Optimized OLTP Engine Agenda Introduction to Hekaton Design Consideration High Level Architecture Storage and Indexing Query Processing Transaction Management Transaction Durability

More information

CSE 190D Spring 2017 Final Exam

CSE 190D Spring 2017 Final Exam CSE 190D Spring 2017 Final Exam Full Name : Student ID : Major : INSTRUCTIONS 1. You have up to 2 hours and 59 minutes to complete this exam. 2. You can have up to one letter/a4-sized sheet of notes, formulae,

More information

Database Management Systems Paper Solution

Database Management Systems Paper Solution Database Management Systems Paper Solution Following questions have been asked in GATE CS exam. 1. Given the relations employee (name, salary, deptno) and department (deptno, deptname, address) Which of

More information

Concurrency Control CHAPTER 17 SINA MERAJI

Concurrency Control CHAPTER 17 SINA MERAJI Concurrency Control CHAPTER 17 SINA MERAJI Announcement Sign up for final project presentations here: https://docs.google.com/spreadsheets/d/1gspkvcdn4an3j3jgtvduaqm _x4yzsh_jxhegk38-n3k/edit#gid=0 Deadline

More information

Overview of Transaction Management

Overview 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 information

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

Final Review. CS634 May 11, Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Final Review CS634 May 11, 2016 Slides based on Database Management Systems 3 rd ed, Ramakrishnan and Gehrke Coverage Text, chapters 8 through 18, 25 (hw1 hw6) PKs, FKs, E-R to Relational: Text, Sec. 3.2-3.5,

More information

Problems Caused by Failures

Problems 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 information

CSE 190D Spring 2017 Final Exam Answers

CSE 190D Spring 2017 Final Exam Answers CSE 190D Spring 2017 Final Exam Answers Q 1. [20pts] For the following questions, clearly circle True or False. 1. The hash join algorithm always has fewer page I/Os compared to the block nested loop join

More information

Chapter 15 : Concurrency Control

Chapter 15 : Concurrency Control Chapter 15 : Concurrency Control What is concurrency? Multiple 'pieces of code' accessing the same data at the same time Key issue in multi-processor systems (i.e. most computers today) Key issue for parallel

More information

DATABASE MANAGEMENT SYSTEMS

DATABASE MANAGEMENT SYSTEMS www..com Code No: N0321/R07 Set No. 1 1. a) What is a Superkey? With an example, describe the difference between a candidate key and the primary key for a given relation? b) With an example, briefly describe

More information

Transaction Management

Transaction 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 information

CMPS 181, Database Systems II, Final Exam, Spring 2016 Instructor: Shel Finkelstein. Student ID: UCSC

CMPS 181, Database Systems II, Final Exam, Spring 2016 Instructor: Shel Finkelstein. Student ID: UCSC CMPS 181, Database Systems II, Final Exam, Spring 2016 Instructor: Shel Finkelstein Student Name: Student ID: UCSC Email: Final Points: Part Max Points Points I 15 II 29 III 31 IV 19 V 16 Total 110 Closed

More information

Last Class Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications

Last Class Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications Last Class Carnegie Mellon Univ. Dept. of Computer Science 15-415/615 - DB Applications Basic Timestamp Ordering Optimistic Concurrency Control Multi-Version Concurrency Control C. Faloutsos A. Pavlo Lecture#23:

More information

Transaction Management and Concurrency Control. Chapter 16, 17

Transaction 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 information

Advances in Data Management Transaction Management A.Poulovassilis

Advances in Data Management Transaction Management A.Poulovassilis 1 Advances in Data Management Transaction Management A.Poulovassilis 1 The Transaction Manager Two important measures of DBMS performance are throughput the number of tasks that can be performed within

More information

Queen s University Faculty of Arts and Science School of Computing CISC 432* / 836* Advanced Database Systems

Queen s University Faculty of Arts and Science School of Computing CISC 432* / 836* Advanced Database Systems HAND IN Queen s University Faculty of Arts and Science School of Computing CISC 432* / 836* Advanced Database Systems Final Examination December 14, 2002 Instructor: Pat Martin Instructions: 1. This examination

More information

CMSC 461 Final Exam Study Guide

CMSC 461 Final Exam Study Guide CMSC 461 Final Exam Study Guide Study Guide Key Symbol Significance * High likelihood it will be on the final + Expected to have deep knowledge of can convey knowledge by working through an example problem

More information

AC61/AT61 DATABASE MANAGEMENT SYSTEMS JUNE 2013

AC61/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 information

Database Tuning and Physical Design: Execution of Transactions

Database Tuning and Physical Design: Execution of Transactions Database Tuning and Physical Design: Execution of Transactions Spring 2018 School of Computer Science University of Waterloo Databases CS348 (University of Waterloo) Transaction Execution 1 / 20 Basics

More information

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

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 FINAL CSE 232, March 20, 2000 (open book) (Please print your name): FIRSTNAME: LASTNAME: TIME: You have 2 1/2 hours (150 minutes) to complete this exam. Problem Max. Points 1 12 2 10 3 28 4 12 5 15 6 16

More information

Transaction Processing. Introduction to Databases CompSci 316 Fall 2018

Transaction 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 information

Transaction Management Overview

Transaction 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 information

Concurrency Control. Chapter 17. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1

Concurrency Control. Chapter 17. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Concurrency Control Chapter 17 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Conflict Schedules Two actions conflict if they operate on the same data object and at least one of them

More information

Database System Concepts

Database System Concepts Chapter 13: Query Processing s Departamento de Engenharia Informática Instituto Superior Técnico 1 st Semester 2008/2009 Slides (fortemente) baseados nos slides oficiais do livro c Silberschatz, Korth

More information

Intro to Transactions

Intro to Transactions Reading Material CompSci 516 Database Systems Lecture 14 Intro to Transactions [RG] Chapter 16.1-16.3, 16.4.1 17.1-17.4 17.5.1, 17.5.3 Instructor: Sudeepa Roy Acknowledgement: The following slides have

More information

Database Management Systems Reliability Management

Database Management Systems Reliability Management Database Management Systems Reliability Management D B M G 1 DBMS Architecture SQL INSTRUCTION OPTIMIZER MANAGEMENT OF ACCESS METHODS CONCURRENCY CONTROL BUFFER MANAGER RELIABILITY MANAGEMENT Index Files

More information

Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Last Class. Today s Class. Faloutsos/Pavlo CMU /615

Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Last Class. Today s 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 1 (R&G ch. 18) Last Class Basic Timestamp Ordering Optimistic Concurrency

More information

Database Management Systems (COP 5725) Homework 3

Database Management Systems (COP 5725) Homework 3 Database Management Systems (COP 5725) Homework 3 Instructor: Dr. Daisy Zhe Wang TAs: Yang Chen, Kun Li, Yang Peng yang, kli, ypeng@cise.uf l.edu November 26, 2013 Name: UFID: Email Address: Pledge(Must

More information

CSE 562 Final Exam Solutions

CSE 562 Final Exam Solutions CSE 562 Final Exam Solutions May 12, 2014 Question Points Possible Points Earned A.1 7 A.2 7 A.3 6 B.1 10 B.2 10 C.1 10 C.2 10 D.1 10 D.2 10 E 20 Bonus 5 Total 105 CSE 562 Final Exam 2014 Relational Algebra

More information

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

Introduction 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 information

Concurrency Control. Chapter 17. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke

Concurrency Control. Chapter 17. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke Concurrency Control Chapter 17 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke Confict Serializable Schedules Two schedules are confict equivalent if: Involve the same actions of the same

More information

Chapter 20 Introduction to Transaction Processing Concepts and Theory

Chapter 20 Introduction to Transaction Processing Concepts and Theory Chapter 20 Introduction to Transaction Processing Concepts and Theory - Logical units of DB processing - Large database and hundreds of transactions - Ex. Stock market, super market, banking, etc - High

More information

ARIES (& Logging) April 2-4, 2018

ARIES (& 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 information

Physical Disk Structure. Physical Data Organization and Indexing. Pages and Blocks. Access Path. I/O Time to Access a Page. Disks.

Physical Disk Structure. Physical Data Organization and Indexing. Pages and Blocks. Access Path. I/O Time to Access a Page. Disks. Physical Disk Structure Physical Data Organization and Indexing Chapter 11 1 4 Access Path Refers to the algorithm + data structure (e.g., an index) used for retrieving and storing data in a table The

More information

ACID 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. 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 information

Indexing. Chapter 8, 10, 11. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1

Indexing. Chapter 8, 10, 11. Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Indexing Chapter 8, 10, 11 Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Tree-Based Indexing The data entries are arranged in sorted order by search key value. A hierarchical search

More information

University of Waterloo Midterm Examination Sample Solution

University of Waterloo Midterm Examination Sample Solution 1. (4 total marks) University of Waterloo Midterm Examination Sample Solution Winter, 2012 Suppose that a relational database contains the following large relation: Track(ReleaseID, TrackNum, Title, Length,

More information

Transactions and Concurrency Control

Transactions and Concurrency Control Transactions and Concurrency Control Computer Science E-66 Harvard University David G. Sullivan, Ph.D. Overview A transaction is a sequence of operations that is treated as a single logical operation.

More information

Deadlock Prevention (cont d) Deadlock Prevention. Example: Wait-Die. Wait-Die

Deadlock Prevention (cont d) Deadlock Prevention. Example: Wait-Die. Wait-Die Deadlock Prevention Deadlock Prevention (cont d) 82 83 When there is a high level of lock contention and an increased likelihood of deadlocks Prevent deadlocks by giving each Xact a priority Assign priorities

More information

Database System Concepts

Database 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 information

Implementing Isolation

Implementing Isolation CMPUT 391 Database Management Systems Implementing Isolation Textbook: 20 & 21.1 (first edition: 23 & 24.1) University of Alberta 1 Isolation Serial execution: Since each transaction is consistent and

More information

Transaction Management: Crash Recovery (Chap. 18), part 1

Transaction 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 information

some sequential execution crash! Recovery Manager replacement MAIN MEMORY policy DISK

some 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 information

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

Query Optimization. Query Optimization. Optimization considerations. Example. Interaction of algorithm choice and tree arrangement. COS 597: Principles of Database and Information Systems Query Optimization Query Optimization Query as expression over relational algebraic operations Get evaluation (parse) tree Leaves: base relations

More information

CS 347 Parallel and Distributed Data Processing

CS 347 Parallel and Distributed Data Processing CS 347 Parallel and Distributed Data Processing Spring 2016 Notes 5: Concurrency Control Topics Data Database design Queries Decomposition Localization Optimization Transactions Concurrency control Reliability

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) DBMS Internals- Part VI Lecture 14, March 12, 2014 Mohammad Hammoud Today Last Session: DBMS Internals- Part V Hash-based indexes (Cont d) and External Sorting Today s Session:

More information

XI. Transactions CS Computer App in Business: Databases. Lecture Topics

XI. Transactions CS Computer App in Business: Databases. Lecture Topics XI. Lecture Topics Properties of Failures and Concurrency in SQL Implementation of Degrees of Isolation CS338 1 Problems Caused by Failures Accounts(, CId, BranchId, Balance) update Accounts set Balance

More information

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

Transaction 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 information

Recoverability. Kathleen Durant PhD CS3200

Recoverability. Kathleen Durant PhD CS3200 Recoverability Kathleen Durant PhD CS3200 1 Recovery Manager Recovery manager ensures the ACID principles of atomicity and durability Atomicity: either all actions in a transaction are done or none are

More information

Chapter 12: Query Processing. Chapter 12: Query Processing

Chapter 12: Query Processing. Chapter 12: Query Processing Chapter 12: Query Processing Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 12: Query Processing Overview Measures of Query Cost Selection Operation Sorting Join

More information

Database Administration and Tuning

Database Administration and Tuning 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

More information

Chapter 17: Recovery System

Chapter 17: Recovery System Chapter 17: Recovery System Database System Concepts See www.db-book.com for conditions on re-use Chapter 17: Recovery System Failure Classification Storage Structure Recovery and Atomicity Log-Based Recovery

More information

CISC437/637 Database Systems Final Exam

CISC437/637 Database Systems Final Exam CISC437/637 Database Systems Final Exam You have from 1:00 to 3:00pm to complete the following questions. The exam is closed-note and closed-book. Good luck! Multiple Choice (2 points each; 52 total) x

More information

COSC344 Database Theory and Applications. Lecture 21 Transactions

COSC344 Database Theory and Applications. Lecture 21 Transactions COSC344 Database Theory and Applications Lecture 21 Transactions - Overview This Lecture Transactions Source: Chapter 20 Next Lecture Concurrency control Source: Chapter 21 Lecture After Recovery Source:

More information

Intro to Transaction Management

Intro 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 information

CISC437/637 Database Systems Final Exam

CISC437/637 Database Systems Final Exam CISC437/637 Database Systems Final Exam You have from 1:00 to 3:00pm to complete the following questions. The exam is closed-note and closed-book. Good luck! Multiple Choice (2 points each; 52 total) 1.

More information

Chapter 17: Recovery System

Chapter 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 information

Failure Classification. Chapter 17: Recovery System. Recovery Algorithms. Storage Structure

Failure 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 information

ARIES. Handout #24. Overview

ARIES. Handout #24. Overview Handout #24 ARIES Overview Failure Model Goals CLRs Data Structures Normal Processing Checkpoints and Restart Media Recovery Nested Top Actions Design Decisions CS346 - Transaction Processing Markus Breunig

More information

Data on External Storage

Data on External Storage Advanced Topics in DBMS Ch-1: Overview of Storage and Indexing By Syed khutubddin Ahmed Assistant Professor Dept. of MCA Reva Institute of Technology & mgmt. Data on External Storage Prg1 Prg2 Prg3 DBMS

More information

Outline. Purpose of this paper. Purpose of this paper. Transaction Review. Outline. Aries: A Transaction Recovery Method

Outline. 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 information

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

Transaction 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 information

Lecture 21: Logging Schemes /645 Database Systems (Fall 2017) Carnegie Mellon University Prof. Andy Pavlo

Lecture 21: Logging Schemes /645 Database Systems (Fall 2017) Carnegie Mellon University Prof. Andy Pavlo Lecture 21: Logging Schemes 15-445/645 Database Systems (Fall 2017) Carnegie Mellon University Prof. Andy Pavlo Crash Recovery Recovery algorithms are techniques to ensure database consistency, transaction

More information

IMPORTANT: Circle the last two letters of your class account:

IMPORTANT: Circle the last two letters of your class account: Fall 2001 University of California, Berkeley College of Engineering Computer Science Division EECS Prof. Michael J. Franklin FINAL EXAM CS 186 Introduction to Database Systems NAME: STUDENT ID: IMPORTANT:

More information

! Parallel machines are becoming quite common and affordable. ! Databases are growing increasingly large

! Parallel machines are becoming quite common and affordable. ! Databases are growing increasingly large Chapter 20: Parallel Databases Introduction! Introduction! I/O Parallelism! Interquery Parallelism! Intraquery Parallelism! Intraoperation Parallelism! Interoperation Parallelism! Design of Parallel Systems!

More information

Chapter 20: Parallel Databases

Chapter 20: Parallel Databases Chapter 20: Parallel Databases! Introduction! I/O Parallelism! Interquery Parallelism! Intraquery Parallelism! Intraoperation Parallelism! Interoperation Parallelism! Design of Parallel Systems 20.1 Introduction!

More information

Chapter 20: Parallel Databases. Introduction

Chapter 20: Parallel Databases. Introduction Chapter 20: Parallel Databases! Introduction! I/O Parallelism! Interquery Parallelism! Intraquery Parallelism! Intraoperation Parallelism! Interoperation Parallelism! Design of Parallel Systems 20.1 Introduction!

More information

Spring 2013 CS 122C & CS 222 Midterm Exam (and Comprehensive Exam, Part I) (Max. Points: 100)

Spring 2013 CS 122C & CS 222 Midterm Exam (and Comprehensive Exam, Part I) (Max. Points: 100) Spring 2013 CS 122C & CS 222 Midterm Exam (and Comprehensive Exam, Part I) (Max. Points: 100) Instructions: - This exam is closed book and closed notes but open cheat sheet. - The total time for the exam

More information

Final Exam CSE232, Spring 97

Final 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 information

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

Slides 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 information

Chapter 17: Parallel Databases

Chapter 17: Parallel Databases Chapter 17: Parallel Databases Introduction I/O Parallelism Interquery Parallelism Intraquery Parallelism Intraoperation Parallelism Interoperation Parallelism Design of Parallel Systems Database Systems

More information

Administração e Optimização de Bases de Dados 2012/2013 Index Tuning

Administração e Optimização de Bases de Dados 2012/2013 Index Tuning Administração e Optimização de Bases de Dados 2012/2013 Index Tuning Bruno Martins DEI@Técnico e DMIR@INESC-ID Index An index is a data structure that supports efficient access to data Condition on Index

More information

Database Management Systems Written Exam

Database Management Systems Written Exam Database Management Systems Written Exam 07.0.011 First name Student number Last name Signature Instructions for Students Write your name, student number, and signature on the exam sheet and on every solution

More information

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

Introduction to Query Processing and Query Optimization Techniques. Copyright 2011 Ramez Elmasri and Shamkant Navathe Introduction to Query Processing and Query Optimization Techniques Outline Translating SQL Queries into Relational Algebra Algorithms for External Sorting Algorithms for SELECT and JOIN Operations Algorithms

More information

Transaction Management

Transaction Management .. CSC 468 DBMS Implementation Alexander Dekhtyar.. Motivation Transaction Management Database Management System Front End: 1. (i) Accept query from user 2. (ii) Process query 3. (iii) Output result Step

More information

Outline. Database Management and Tuning. Index Tuning Examples. Exercise 1 Query for Student by Name. Concurrency Tuning. Johann Gamper.

Outline. Database Management and Tuning. Index Tuning Examples. Exercise 1 Query for Student by Name. Concurrency Tuning. Johann Gamper. Outline Database Management and Tuning Johann Gamper 1 Free University of Bozen-Bolzano Faculty of Computer Science IDSE Unit 7 2 3 Conclusion Acknowledgements: The slides are provided by Nikolaus Augsten

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) DBMS Internals- Part VI Lecture 17, March 24, 2015 Mohammad Hammoud Today Last Two Sessions: DBMS Internals- Part V External Sorting How to Start a Company in Five (maybe

More information

Outline. Database Tuning. Join Strategies Running Example. Outline. Index Tuning. Nikolaus Augsten. Unit 6 WS 2014/2015

Outline. Database Tuning. Join Strategies Running Example. Outline. Index Tuning. Nikolaus Augsten. Unit 6 WS 2014/2015 Outline Database Tuning Nikolaus Augsten University of Salzburg Department of Computer Science Database Group 1 Examples Unit 6 WS 2014/2015 Adapted from Database Tuning by Dennis Shasha and Philippe Bonnet.

More information