Understanding Isolation Levels and Locking

Size: px
Start display at page:

Download "Understanding Isolation Levels and Locking"

Transcription

1 Platform: DB2 UDB for Linux, UNIX, and Windows Understanding Isolation Levels and Locking Roger E. Sanders Network Appliance, Inc. Global Systems Engineer Session: G10 Wednesday, 26 October :00 AM to 12:00 PM Title: Understanding Isolation Levels and Locking Abstract: Individuals who have taken the DB2 Family Fundamentals (700) exam often tell me they received their lowest scores on the section that covers isolation levels and locking. This implies that these two concepts remain a mystery to a large number of DB2 users. This presentation is designed to take away the mystery and replace it with a solid understanding of the components DB2 UDB uses to make database concurrency possible. Roger E. Sanders Global Systems Engineer Network Appliance, Inc. 627 Davis Drive, Suite 200 Morrisville, NC Phone: (919) rsanders@netapp.com 1

2 Topics To Be Discussed... Data consistency and database concurrency What isolation levels are and how they are used What locks are and how they are used Locks and performance Designing databases and applications with locking in mind 2 Presentation Outline: I. Data consistency and database concurrency A. Understanding data consistency B. Transactions C. Phenomena seen when transactions run concurrently D. Designing for concurrency II. Isolation levels A. Repeatable Read (RR) B. Read Stability (RS) C. Cursor Stability (CS) D. Uncommitted Read (UR) E. Choosing the proper isolation level F. Specifying the isolation level to use III. Locks A. What is a lock? B. Lock attributes C. Lock states D. How locks are acquired IV. Locks and performance A. Lock compatibility B. Lock waits and timeouts C. Lock conversion D. Lock escalation E. Deadlocks F. Lock granularity 2

3 Data Consistency And Database Concurrency Allowing multiple users to access a database simultaneously without compromising data integrity. 3 Let s get started by taking a look at what can happen when several different users attempt to access a database at the same time. 3

4 Understanding Data Consistency RESTAURANT A RESTAURANT B BEFORE UPDATE: Actual - 4 bottles; Database - 4 bottles AFTER UPDATE: Actual - 4 bottles; Database - 5 bottles 4 What Is Data Consistency? The best way to define data consistency is by example. Suppose your company owns a chain of restaurants, and you have a database that is designed to keep track of supplies stored at each of those restaurants. This database contains an inventory table for each restaurant in the chain and whenever supplies are received or used by a restaurant, the inventory table for that particular restaurant is updated. Now, suppose some bottles of catsup are physically moved from one restaurant to another. The catsup bottle count value stored in the receiving restaurant s table needs to be raised and the catsup bottle count value stored in the donating restaurant s table needs to be lowered in order to accurately represent this inventory move. If a user raises the catsup bottle count in the receiving restaurant s inventory table, but fails to lower the catsup bottle count in the donating restaurant s inventory table, the data will become inconsistent. Now, the total catsup bottle inventory for the chain of restaurants is no longer accurate. A database can become inconsistent if the database user forgets to make all the necessary changes (as in the previous example), if the system crashes when the user is in the middle of making changes, or if a database application, for some reason, stops prematurely. Inconsistency can also occur when several users are accessing the same database tables at the same time. For example, one user might read another user s changes before all tables have been properly updated and make an inappropriate change based on the premature data values read. Note: This slide looks a little confusing in a printout because of the way it has been constructed for animation. Refer to the slide shown in the presentation for clarity. 4

5 Transactions A transaction (or unit of work) is a recoverable sequence of one or more SQL operations that are grouped together as a single unit, usually within an application process. Transaction types: Interleaved or Parallel Serializable* *Ideally, all transactions should be serializable 5 One of the mechanisms DB2 UDB uses to keep data consistent is the transaction. A transaction or (otherwise known as a unit of work) is a recoverable sequence of one or more SQL operations that are grouped together as a single unit, usually within an application process. The initiation and termination of a single transaction defines points of data consistency within a database; either the effects of all SQL operations performed within a transaction are applied to the database and made permanent (committed), or the effects of all SQL operations performed are completely "undone" and thrown away (rolled back). In single-user environments, each transaction runs serially and does not have to contend with interference from other transactions. However, in multi-user environments, transactions can run simultaneously and each transaction has the potential to interfere with any other active transaction. Transactions that have the potential of interfering with one another are said to be interleaved or parallel transactions while transactions that run isolated from each other are said to be serializable, which means that the results of running them simultaneously will be no different from the results of running them one right after another (serially). Ideally, every transaction should be serializable. Why is it important that transactions be serializable? Consider the following: Suppose a salesperson is entering orders into a database system at the same time an accountant is using the system to generate bills. Now, suppose the salesperson enters an order for Company X (to get a price quote) but does not commit the entry. While the salesperson is relaying the price quote information to an individual from Company X, the accountant queries the database for a list of all unpaid orders, sees an unpaid order for Company X, and generates a bill. Now, suppose the individual from Company X decides not to place the order because the quoted price is higher than expected. The salesperson rolls back the transaction because no order was placed, and the order information used to produce the price quote is removed from 5

6 Phenomena Seen When Transactions Run Concurrently Lost Updates Dirty Reads Non-repeatable Reads Phantoms 6 When transactions are not isolated from each other in multi-user environments, four types of events, or phenomena, can occur: Lost Updates Dirty Reads Non-repeatable Reads Phantoms 6

7 Lost Updates Occurs when two transactions read the same data, both attempt to update the data read, and one of the updates is lost Never occurs with DB2 UDB 7 Lost Updates This event occurs when two transactions read the same data, both then attempt to update that data, and one of the updates is lost. For example: Transaction 1 and Transaction 2 read the same row of data and both calculate new values for that row based upon the original values read. If Transaction 1 updates the row with its new value and Transaction 2 then updates the same row, the update operation performed by Transaction 1 is lost. Fortunately, DB2 UDB has been designed in such a way that this type of event cannot occur. 7

8 Dirty Reads Occurs when a transaction reads data that has not yet been committed Only happens in special cases with DB2 UDB (specifically, when a transaction is running under the Uncommitted Read isolation level) 8 Dirty Reads This event occurs when a transaction reads data that has not yet been committed. For example: Transaction 1 changes a row of data and Transaction 2 reads the changed row before Transaction 1 commits the change. If Transaction 1 rolls back the change, Transaction 2 will have read data that theoretically, never existed. 8

9 Non-Repeatable Reads Occurs when a transaction executes the same query multiple times and gets different results with each execution Only happens in special cases with DB2 UDB (specifically, when a transaction is running under the Read Stability or Cursor Stability isolation level) 9 Non-Repeatable Reads This event occurs when a transaction reads the same row of data twice, but gets different results each time. For example: Transaction 1 reads a row of data, then Transaction 2 modifies or deletes that row and commits the change. When Transaction 1 attempts to reread the row, it will retrieve different data values (if the row was updated) or discover that the row no longer exists (if the row was deleted). 9

10 Phantoms Occurs when a row of data that matches some search criteria is not seen initially Can happen often with DB2 UDB (specifically, anytime a transaction is running under any isolation level other than the Repeatable Read isolation level) 10 Phantoms This event occurs when a row of data matches some search criteria, but initially is not seen. For example: Transaction 1 retrieves a set of rows that satisfy some search criteria, then Transaction 2 inserts a new row that contains matching search criteria for Transaction 1 s query. If Transaction 1 re-executes the query that produced the original set of rows, a different set of rows will be retrieved the new row added by Transaction 2 will now be included in the set of rows returned. 10

11 Things To Consider When Designing For Concurrency How can data consistency be maintained when you do not know what actions a user wants to perform? How can you keep an application from accidentally destroying data consistency? How can you ensure that applications working with a database simultaneously will not inadvertently destroy data consistency? 11 Maintaining data consistency and integrity, while allowing multiple transactions to access the same data at the same time, is known as concurrency. When designing for concurrency, database product developers must consider the following: How can you maintain data consistency at all times when you do not know what action each individual database owner/user wants to perform? How can you keep a single application from accidentally destroying data consistency? How can you ensure that multiple applications, accessing the same data at the same time, will not destroy data consistency? 11

12 DB2 UDB s Concurrency Support Mechanisms Isolation levels Locks 12 In response to these questions, two different data consistency support mechanisms were incorporated into DB2 Universal Database s design. These two mechanisms are known as isolation levels and locks. We ll look at each in the following sections. 12

13 Isolation Levels How transactions are isolated from each other in multi-user environments. 13 Now that you know what database concurrency is and are familiar with what can happen when two or more transactions attempt to work with the same data resource at the same time, let s look at how the first mechanism DB2 UDB uses to provide concurrency support isolation levels works. 13

14 Isolation Levels Available Repeatable Read (RR) Read Stability (RS) Cursor Stability (CS) Uncommitted Read (UR) Most Restrictive Least Restrictive 14 One of the ways DB2 Universal Database attempts to enforce concurrency is through the use of isolation levels, which determine how a data resource used in one transaction is isolated from other transactions while it is being accessed. DB2 Universal Database recognizes and supports the following isolation levels: Repeatable Read Read Stability Cursor Stability Uncommitted Read 14

15 Repeatable Read Completely isolates one transaction from the effects of other transactions Prevents lost updates, dirty reads, non-repeatable reads, and phantoms Locks all rows accessed by the transaction (often acquires table-level locks when an index scan is performed) (If a transaction using RR scans the same table two or more times, the results will always be the same.) 15 Repeatable Read The Repeatable Read isolation level completely isolates one transaction from the effects of other, concurrent transactions. When this isolation level is used, every row that is referenced in any manner by the isolated transaction is locked for the duration of that transaction. As a result, if the same SELECT statement is issued two or more times within the same transaction, the result data set produced will always be the same; lost updates, dirty reads, non-repeatable reads, and phantoms cannot occur. Transactions using the Repeatable Read isolation level can retrieve the same set of rows multiple times and perform any number of operations on them until terminated, either by a commit or a rollback operation. However, no other transaction is allowed to perform an insert, update, or delete operation that would affect the set of rows being accessed by the isolating transaction while that transaction remains active. To ensure that the data being accessed by a transaction running under the Repeatable Read isolation level is not adversely affected by other transactions, each row referenced by the isolating transaction is locked -- not just the rows that are actually retrieved and/or modified. Thus, if a transaction scans 1000 rows in order to retrieve 10, locks are acquired and held on all 1000 rows scanned -- not just on the 10 rows retrieved. 15

16 Repeatable Read (Continued) 16 So how does this isolation level work in a real-world situation? Suppose you own a large hotel and you have a web site that allows individuals to reserve rooms on a first-come, first-served basis. If your hotel reservation application runs under the Repeatable Read isolation level, whenever a customer retrieves a list of all rooms available for a given range of dates, you will not be able to change the room rate for those rooms during the date range specified, nor will other customers be able to make or cancel reservations that would cause the list to change if it were generated again -- as long as the transaction that produced the list is active. (However, you can change room rates for any room that was not scanned in response to the first customer's query. Likewise, other customers can make or cancel room reservations for any room that was not scanned in response to the first customer's query.) 16

17 Read Stability Does not completely isolate transactions from each other Prevents lost updates, dirty reads, and non-repeatable reads; allows phantoms Only locks rows returned to a result data set in response to a query (If a transaction using RS scans the same table two or more times, the results may reflect changes made by other transactions.) 17 Read Stability The Read Stability isolation level does not completely isolate one transaction from the effects of other, concurrent transactions. That s because when the Read Stability isolation level is used, only rows that are actually retrieved by a single transaction are locked for the duration of that transaction. Thus, when this isolation level is used, if the same SELECT statement is issued two or more times (within the same transaction), the result data set produced may not always be the same. (Lost updates, dirty reads, and non-repeatable reads cannot occur; phantoms, however, can and may be seen.). Transactions using the Read Stability isolation level can retrieve a set of rows and perform any number of operations on them until terminated, either by a commit or a rollback operation. However, no other transaction is allowed to perform an update, or delete operation that would affect the set of rows that were retrieved by the isolating transaction as long as that transaction exists. (However, other transactions can perform insert operations and if the transaction running under the Read Stability isolation level executes the same query multiple times, rows inserted by other, concurrent transactions may appear in subsequent result data sets produced.) Changes made to other rows by other transactions will not be seen by a transaction running under the Read Stability isolation level until they have been committed. Unlike the Repeatable Read isolation level where every row that is referenced in any way by the isolating transaction is locked, when the Read Stability isolation level is used, only the rows that are actually retrieved and/or modified by the isolating transaction are locked. Thus, if a transaction scans 1000 rows in order to retrieve 10, locks are only acquired and held on the 10 rows retrieved -- not on all 1000 rows scanned. 17

18 Read Stability (Continued) 18 So how does this isolation level change the way our hotel reservation application works? Now, when a customer retrieves a list of rooms available for a given range of dates, you will be able to change the room rate for any room in the hotel that does not appear on the list and other customers will be able to cancel room reservations for rooms that had been reserved for the date range specified by the first customer's query. Therefore, if the customer generates the list of available rooms again (before the transaction that submitted the query terminates), the list produced may contain new room rates and/or rooms that were not available the first time the list was generated. 18

19 Cursor Stability Limited in the way it isolates transactions from each other Prevents lost updates and dirty reads; allows non-repeatable reads and phantoms Locks one row at a time the row that is currently being accessed by an open cursor Isolation level used by default (If a transaction using CS scans the same table two or more times, the results can reflect changes made by other transactions.) 19 Cursor Stability The Cursor Stability isolation level is even more relaxed in the way it isolates one transaction from the effects of other, concurrent transactions. When this isolation level is used, only the row that is currently being referenced by a cursor that has been declared and opened by the isolating transaction is locked. The lock acquired remains in effect either until the cursor is repositioned (usually by executing the FETCH SQL statement) or until the isolating transaction terminates. (If the cursor is repositioned, the lock being held on the last row read is released and a new lock is acquired for the row the cursor is now positioned on.). When a transaction using the Cursor Stability isolation level retrieves a row from a table using a cursor, no other transaction can update or delete that row while the cursor is positioned on it. However, other transactions can add new rows to the table as well as perform update and/or delete operations on rows positioned on either side of the locked row, provided the locked row itself was not accessed using an index. Furthermore, if the isolating transaction modifies any row it retrieves, no other transaction can update or delete that row until the isolating transaction is terminated, even when the cursor is no longer positioned on the modified row. When the Cursor Stability isolation level is used, if the same SELECT statement is issued multiple times within the same transaction, the results returned may not always be the same. (Lost updates and dirty reads cannot occur; non-repeatable reads and phantoms, on the other hand, can and may be seen.) In addition, transactions using the Cursor Stability isolation level will not see changes made to other rows by other transactions until those changes have been committed. 19

20 Cursor Stability (Continued) 20 So how does this isolation level change the way our hotel reservation application works? Now, when a customer retrieves a list of rooms available for a given range of dates, then views information about each room on the list produced (one room at a time), you will be able to change the room rate for any room in the hotel, over any date range, except for the room the customer is currently looking at. Likewise, other customers will be able to make or cancel reservations for any room in the hotel, over any date range; however, they will not be able to do anything with the room the first customer is currently looking at. When the first customer views information about another room in the list, the same holds true for the new room the customer is looking at. 20

21 Uncommitted Read Does not isolate a transaction from the effects of other transactions Prevents lost updates; allows dirty reads, non-repeatable reads, and phantoms Usually does not acquire locks during processing (A transaction using UR can access uncommitted changes made by other transactions.) 21 Uncommitted Read The Uncommitted Read isolation level is the least intrusive isolation level provided. In fact, when the Uncommitted Read isolation level is used, rows that are retrieved by one transaction are only locked if another transaction attempts to drop or alter the table the rows were retrieved from. Because rows often remain unlocked when this isolation level is used, dirty reads, non-repeatable reads, and phantoms can occur. Because of this, this isolation level is commonly used for transactions that access read-only tables/views or transactions that execute SELECT statements of which uncommitted data from other transactions will have no adverse affect. In most cases, transactions using the Uncommitted Read isolation level can read changes made to rows by other transactions before those changes have been committed. However, such transactions can neither see nor access tables, views, or indexes that are created by other transactions until those transactions themselves have been terminated. The same applies to existing tables, views, or indexes that have been dropped transactions using the Uncommitted Read isolation level will only learn that these objects no longer exist when the transaction that dropped them is terminated. There is one exception to this behavior: when a transaction running under the Uncommitted Read isolation level uses an updatable cursor; in this particular case, the transaction using the updatable cursor will behave as if it is running under the Cursor Stability isolation level and the constraints of the Cursor Stability isolation level will apply. 21

22 Uncommitted Read (Continued) 22 So how does the Uncommitted Read isolation level affect our hotel reservation application? Now, when a customer retrieves a list of rooms available for a given range of dates, you will be able to change the room rate for any room in the hotel and other customers will be able to make or cancel reservations for any room, over any date range. Furthermore, the list produced for the first customer may contain rooms that other customers have chosen to make reservations for, but whose reservations have not yet been committed. 22

23 Choosing The Proper Isolation Level Use Repeatable Read when preventing phenomena is more important than concurrency Use Read Stability when concurrency is desired, but qualified rows need to remain stable for the life of a transaction Use Cursor Stability when you need maximum concurrency, yet do not want to see uncommitted data Use Uncommitted Read when working with read-only tables/databases 23 Choosing the appropriate isolation level to use is very important because not only does the isolation level used influence how well the database supports concurrency, it also controls how well all applications running concurrently perform. Typically, whenever a more restrictive isolation level is used, less concurrency is available. So how do you determine which isolation level to use for a given application? The best way is to determine which types of concurrency phenomena that might arise is unacceptable; then, select an isolation level that will prevent those types of phenomena from occurring. For example: Use the Repeatable Read isolation level if you are executing queries and you do not want other, concurrent transactions to have the ability to make changes that could cause the same query to return different results if ran more than once. Use the Read Stability isolation level when you want some level of concurrency between applications, yet you also want qualified rows to remain stable for the duration of an individual transaction. Use the Cursor Stability isolation level when you want maximum concurrency between applications, yet you do not want queries to return uncommitted data values. Use the Uncommitted Read isolation level if you are executing queries on readonly tables/databases, or if you do not care if a query returns uncommitted data values. 23

24 Specifying the Isolation Level to Use The ISOLATION option of the PRECOMPILE and BIND commands (Embedded SQL) The SQL_ATTR_TXN_ISOLATION ODBC/CLI connection attribute (ODBC/CLI) The settransactionisolation()jdbc method (JDBC) The CHANGE ISOLATION command (CLP Scripts) The WITH [RR RS CS UR] option of a SELECT statement 24 Although isolation levels control concurrency at the transaction level, they are actually set at the application level. Therefore, in most cases, the isolation level specified for a particular application is applicable to every transaction that is initiated by that application. (An application can be constructed in several different parts and each part can be assigned a different isolation level, in which case, the isolation level specified for a particular part is applicable to every transaction that is created within that part.) For embedded SQL applications, the isolation level to be used is specified at precompile time or when the application is bound to a database (if deferred binding is used). The isolation level for embedded SQL applications is set through the ISOLATION option of the PRECOMPILE and BIND commands. The isolation level for Open Database Connectivity (ODBC) and Call Level Interface (CLI) applications is set at application run time by calling the SQLSetConnectAttr() function with the SQL_ATTR_TXN_ISOLATION connection attribute specified. Alternatively, the isolation level for ODBC/CLI applications can be set by assigning a value to the TXNISOLATION keyword in the db2cli.ini configuration file; however, this approach does not provide the flexibility of changing isolation levels for different transactions within the application that the first approach does. The isolation level for JDBC and SQLJ applications is set at application run time by calling the settransactionisolation() method that resides within DB2 Universal Database s java.sql connection interface. When the isolation level for an application is not explicitly set using one of these methods, the Cursor Stability isolation level is used as the default. This is true for commands, SQL statements, and scripts that are executed from the Command Line Processor (CLP) as well as for embedded SQL, ODBC/CLI, JDBC, and SQLJ applications. Therefore, it is also possible to specify the isolation level that is to be used for any operation that is to be performed from the CLP. In this case, the isolation level is set by executing the CHANGE ISOLATION command before a connection to a database is established. Wi h V i 8 1 h bili if h i l i l l h SELECT 24

25 Locks What locks are and how they are used. 25 Now that you know what isolation levels are and you have some idea about how the isolation level used can impact concurrency, let s look at how the second mechanism DB2 UDB uses to provide concurrency support locks works. 25

26 What Is A Lock? A lock is a mechanism that is used to associate a data resource with a single transaction, for the sole purpose of controlling how other transactions interact with that resource while it is associated with the transaction that has it locked. 26 Locks Just what is a lock? A lock is a mechanism that is used to associate a data resource with a single transaction, for the sole purpose of controlling how other transactions interact with that resource while it is associated with the transaction that has it locked. (The transaction that has a resource associated with it is said to hold or own the lock.) Essentially, locks in a database environment serve the same purpose as they do in a house or a car; they determine who can and cannot gain access to a particular resource which in this case is one or more tablespaces, tables, and/or rows. The DB2 Database Manager imposes locks to prohibit owning transactions from accessing uncommitted data that has written by other transactions (unless the transaction is running under the Uncommitted Read isolation level) and to prevent other transactions from making data modifications that might adversely affect the owning transaction. When an owning transaction is terminated (by being committed or by being rolled back), any changes made to the resource that was locked are made permanent (or removed), and all locks on the resource that had been acquired by the owning transaction are released. Once unlocked, a resource can be locked again and manipulated by any other active transaction. 26

27 Lock Attributes Object (Tablespaces, Tables, Rows) Size (Number of rows locked, table locked) Duration (Length of time lock is held) State (or Mode) (Type of lock acquired) 27 All DB2 Universal Database locks have the following basic attributes: Object This attribute identifies the data resource that is being locked. The DB2 Database Manager implicitly acquires locks on data resources (specifically, tablespaces, tables, and rows) whenever they are needed. Size This attribute identifies the physical size of the portion of the data resource that is being locked. A lock does not always have to control an entire data resource. For example, rather than giving an application exclusive control over an entire table, the DB2 Database Manager can elect to give an application exclusive control over one or more specific rows in a table. Duration This attribute identifies the length of time a lock is held. The isolation level used has a significant impact on the duration of a lock. State (or Mode) This attribute identifies the type of access that is allowed for the lock owner as well as the type of access permitted for concurrent users of the locked data resource. 27

28 Lock States Intent None Intent Share Next Key Share Share Intent Exclusive Share With Intent Exclusive Update Next Key Weak Exclusive Exclusive Weak Exclusive Super Exclusive An Intent None lock is the least restrictive lock that can be held; a Super Exclusive lock is the most restrictive lock that can be held. 28 There are eleven different lock states available and the state of the lock used determines the type of access allowed for the lock owner, as well as the type of access permitted to concurrent users of the locked resource. The list on this slide identifies the lock states that are available, in order of increasing control. 28

29 Intent None (IN) Applicable Objects : Tablespaces, Tables Lock Owner : Can read all data including uncommitted data, but cannot modify data stored in the locked resource Other Transactions : Can both read and modify data stored in the locked resource Acquired by read-only transactions that do not convey the intent to modify data. 29 Intent None (IN) When an Intent None (IN) lock is held on a resource, the lock owner is allowed to read, but not modify data, including uncommitted data, stored in the locked resource (which in this case, can be a tablespace or a table). On the other hand, other transactions are allowed to both read and modify data stored in the resource while it is locked. Intent None locks are typically acquired for read-only transactions that have no intention of modifying data (transactions that execute SELECT FOR UPDATE, UPDATE WHERE, and/or INSERT statements convey the intent to modify data). Thus, additional locks will not be acquired on the transaction s behalf. 29

30 Intent Share (IS) Applicable Objects : Tablespaces, Tables Lock Owner : Can read, but cannot modify data stored in the locked resource Other Transactions : Can both read and modify data stored in the locked resource Acquired by non-read-only transactions that do not convey the intent to modify data. 30 Intent Share (IS) When an Intent Share (IS) lock is held on a resource, the lock owner is allowed to read, but not modify data stored in the locked resource (which in this case, can be a tablespace or a table). On the other hand, other transactions are allowed to both read and modify data stored in the resource while it is locked. Intent Share locks are typically acquired for transactions that do not convey the intent to modify data (transactions that execute SELECT FOR UPDATE, UPDATE WHERE, and/or INSERT statements convey the intent to modify data). 30

31 Next Key Share (NS) Applicable Objects : Rows All Transactions : Can read, but cannot modify data stored in the locked resource Acquired by transactions using the RS or CS isolation level that do not convey the intent to modify data. (Used instead of Share locks to minimize impact of locking.) 31 Next Key Share (NS) When a Next Key Share (NS) lock is held on a resource, the lock owner is allowed to read, but not modify data stored in the locked resource (which in this case, must be a row). Likewise, other transactions are allowed to read, but not modify data stored in the resource while it is locked. Next Key Share locks are typically acquired in place of a Share (S) lock for transactions that are running under the Read Stability (RS) or Cursor Stability (CS) isolation level. 31

32 Share (S) Applicable Objects : Tables, Rows All Transactions : Can read, but cannot modify data stored in the locked resource Acquired by transactions using the RR isolation level that do not convey the intent to modify data. 32 Share (S) When an Share (S) lock is held on a resource, the lock owner is allowed to read, but not modify data (excluding uncommitted data) stored in the locked resource (which in this case, can be a table or a row). Likewise, other transactions are allowed to read, but not modify data stored in the resource while it is locked. Share locks are typically acquired for transactions that do not convey the intent to modify data (transactions that execute SELECT FOR UPDATE, UPDATE WHERE, and/or INSERT statements convey the intent to modify data) that are running under the Repeatable Read (RR) isolation level. 32

33 Intent Exclusive (IX) Applicable Objects : Tablespaces, Tables All Transactions : Can both read and modify data stored in the locked resource Acquired by transactions that convey the intent to modify data. 33 Intent Exclusive (IX) When an Intent Exclusive (IX) lock is held on a resource, the lock owner is allowed to both read and modify data stored in the locked resource (which in this case, can be a tablespace or a table). Likewise, other transactions are allowed to read and modify data stored in the resource while it is locked. Intent Exclusive locks are typically acquired for transactions that convey the intent to modify data (transactions that execute SELECT FOR UPDATE, UPDATE WHERE, and/or INSERT statements convey the intent to modify data). When the lock owner works with an Intent Exclusive (IX) locked table, a Share (S) or a Next Key Share (NS) lock is acquired on every row read from that table and an Update (U) or an Exclusive (X) lock is acquired on every row in the table that is to be modified. 33

34 Share With Intent Exclusive (SIX) Applicable Objects : Tables Lock Owner : Can both read and modify data stored in the locked resource Other Transactions : Can read, but cannot modify data stored in the locked resource Acquired by transactions holding a Share lock that need an Intent Exclusive lock (or vice versa). 34 Share With Intent Exclusive (SIX) When a Share With Intent Exclusive (SIX) lock is held on a resource, the lock owner is allowed to both read and modify data stored in the locked resource (which in this case, must be a table). Other transactions, however, are only allowed to read data (except for uncommitted data) stored in the resource while it is locked. Share With Intent Exclusive locks are typically acquired when a transaction holding a Share (S) lock on a resource attempts to acquire an Intent Exclusive (IX) lock on the same resource (or vice versa). 34

35 Update (U) Applicable Objects : Tables, Rows Lock Owner : Can modify, but cannot read data stored in the locked resource Other Transactions : Can read, but cannot modify data stored in the locked resource Acquired by transactions that modify, but do not retrieve data. 35 Update (U) When an Update (U) lock is held on a resource, the lock owner is allowed to modify, but not read data stored in the locked resource (which in this case, can be a table or a row). Other transactions, however, are allowed to read, but not modify data (except for uncommitted data) stored in the resource while it is locked. Update locks are typically acquired for transactions that modify data with INSERT, UPDATE, and/or DELETE statements. 35

36 Next Key Weak Exclusive (NW) Applicable Objects : Rows All Transactions : Can read, but cannot modify data stored in the locked resource Acquired on the next available row in a table when a row is added to a non-catalog table index. 36 Next Key Weak Exclusive (NW) When a Next Key Weak Exclusive (NW) lock is held on a resource, the lock owner is allowed to read, but not modify data stored in the locked resource (which in this case, must be a row). Likewise, other transactions are allowed to read, but not modify data stored in the resource while it is locked. Next Key Weak Exclusive locks are typically acquired on the next available row in a table whenever a row is inserted into any index of a non-catalog table. 36

37 Exclusive (X) Applicable Objects : Tables, Rows Lock Owner : Can both read and modify data stored in the locked resource Other Transactions : Can neither read nor modify data stored in the locked resource unless UR isolation level is used (in which case data can be read) Acquired when a transaction both reads and modifies data. 37 Exclusive (X) When an Exclusive (X) lock is held on a resource, the lock owner is allowed to both read and modify data stored in the locked resource (which in this case, can be a table or a row). Other transactions, however, are not allowed to read nor modify data stored in the resource while it is locked unless the are running under the Uncommitted Read (UR) isolation level (in which case, they can read but cannot modify data stored in the locked resource). Exclusive locks are typically acquired for transactions that retrieve data with SELECT statements and modify data with INSERT, UPDATE, and/or DELETE statements. 37

38 Weak Exclusive (WE) Applicable Objects : Rows Lock Owner : Can both read and modify data stored in the locked resource Other Transactions : Can neither read nor modify data stored in the locked resource unless UR isolation level is used (in which case data can be read) Acquired when a row is added to a non-catalog table. 38 Weak Exclusive (WE) When a Weak Exclusive (WE) lock is held on a resource, the lock owner is allowed to both read and modify data stored in the locked resource (which in this case, must be a row). Other transactions, however, are not allowed to read or modify data stored in the resource while it is locked unless they are running under the Uncommitted Read (UR) isolation level (in which case, they can read but cannot modify data stored in the locked resource). Weak Exclusive locks are typically acquired on a row when it is inserted into a nonsystem catalog table. 38

39 Super Exclusive (Z) Applicable Objects : Tablespaces, Tables Lock Owner : Can both read and modify data stored in the locked resource Other Transactions : Can neither read nor modify data stored in the locked resource Acquired when a table is altered or dropped, when an index is created or dropped, or when a table is reorganized. 39 Super Exclusive (Z) When a Super Exclusive (Z) lock is held on a resource, the lock owner is allowed to both read and modify data stored in the locked resource (which in this case, can be a tablespace or a table). Other transactions, however, can neither read nor modify data stored in the resource while it is locked. Super Exclusive locks are typically acquired on a table whenever the lock owner attempts to alter that table, drop that table, create an index for that table, drop an index that has already been defined for that table, or reorganize the contents of the table by running the REORG utility (while the table is off-line). 39

40 How are Locks Acquired? Implicitly by the DB2 Database Manager Explicitly by executing the LOCK TABLE SQL Statement: LOCK TABLE [TableName] IN [SHARE EXCLUSIVE] MODE Explicitly by specifying the USE AND KEEP [SHARE UPDATE EXCLUSIVE] LOCKS clause with a SELECT SQL Statement: SELECT * FROM EMPLOYEE WHERE EMPID = 001 WITH RS USE AND KEEP EXCLUSIVE LOCKS 40 The DB2 Database Manager implicitly acquires locks as they are needed and once acquired, these locks remain under the DB2 Database Manager s control until they are no longer needed. As we have already seen, these locks can be placed on tablespaces, tables and/or rows and except for occasions where the Uncommitted Read (UR) isolation level is used, it is never necessary for a transaction to explicitly request a lock. In fact, the only object that can be explicitly locked by a transaction is a table. If you want to explicitly acquire a table-level lock for a particular transaction, you can do so by executing the LOCK TABLE statement immediately after the transaction is initiated. The syntax for the LOCK TABLE statement is: LOCK TABLE [TableName] IN [SHARE EXCLUSIVE] MODE where TableName identifies the name of an existing table that is to be locked. As you can see, the LOCK TABLE statement allows a transaction to acquire a tablelevel lock on a particular table, in one of two modes: SHARE mode and EXCLUSIVE mode. If a table is locked using the SHARE mode, a table-level Share (S) lock is acquired on behalf of the requesting transaction and other concurrent transactions are allowed to read, but not change the data stored in the locked table. On the other hand, if a table is locked using the EXCLUSIVE mode, a table-level Exclusive (X) lock is acquired and other concurrent transactions can neither access nor modify data stored in the locked table. For example, when executed, the statement LOCK TABLE EMPLOYEE IN SHARE MODE will acquire a table-level Share (S) lock on the EMPLOYEE table on behalf of the current transaction (provided no other transaction holds a lock on this table) and other concurrent transactions will be allowed to read, but not change the data stored in the table. On the other hand, if the statement LOCK TABLE EMPLOYEE IN SHARE MODE were executed, a table-level Exclusive (X) lock 40

41 Locks and Performance Factors that can affect locking and that can have a significant impact on performance. 41 Because the DB2 Database Manager implicitly acquires locks as they are needed, aside from using the and LOCK TABLE statement to force the DB2 Database Manager to acquire a table-level lock on behalf of a transaction, locking is out of your control. However, there are several factors that can affect locking that you should be aware of. Knowing what these factors are and understanding how they can impact overall performance, can assist you in designing applications that work well in multi-user database environments, and indirectly, give you more control over how locks are used. 41

42 Lock Compatibility If the state of one lock placed on a resource is such that another lock can be placed on the same resource at the same time by another transaction, the two locks are said to be compatible. A table showing which locks are compatible and which locks are not can be found on page 59 of the DB2 Administration Guide : Performance manual (Version 8.2). For example, if one transaction holds a Share (S) lock on a table, another transaction can also acquire a Share (S) lock on the table because the two locks are compatible. 42 Lock Compatibility If the state of a lock placed on a data resource by one transaction is such that another lock can be placed on the same resource by another transaction before the first lock acquired is released, the two locks (or lock states) are said to be compatible. (For example, if a transaction holds a Share (S) lock on a resource, another transaction can also acquire a Share (S) lock on the resource because the two locks are compatible. However, if a transaction holds a Super Exclusive (Z) lock on a resource, no other transaction can acquire a lock on that resource because the Super Exclusive (Z) lock is incompatible with all other locks.) Any time one transaction holds a lock on a data resource and another transaction attempts to acquire a lock on the same resource, the DB2 Database Manager will examine the two lock states to determine whether they are compatible. If both locks are compatible, the second lock is acquired on behalf of the requesting transaction (provided no other transactions are waiting to acquire their own lock on the data resource). On the other hand, if the two locks are incompatible, the requesting transaction must wait until the owning transaction releases its lock (in fact, the requesting transaction must wait until all existing incompatible locks are released) before it can gain access to the resource and acquire the lock desired. This is known as a lock wait event and when a lock wait event occurs, the transaction attempting to access the locked resource simply stops execution until the owning transaction terminates and the incompatible lock is released or until a lock timeout event occurs. A table showing which locks are compatible and which are not can be found on page 59 of the DB2 Administration Guide : Performance manual. 42

43 Lock Waits and Timeouts When incompatible locks are used, one transaction must wait for the other to finish. By default, a transaction will wait indefinitely to acquire a lock it needs. The locktimeout database configuration parameter provides a way to control how long a transaction will wait to acquire a resource. By default, locktimeout = -1, which means Lock timeout detection is turned off. A locktimeout value of 0 means Don t wait for locks ; any other value means Wait this number of seconds. 43 Lock Waits and Timeouts Any time a transaction holds a lock on a particular resource (tablespace, table, or row), other transactions may be denied access to that resource until the owning transaction terminates and frees all locks it has acquired. And without some sort of lock timeout detection mechanism in place, a transaction might wait indefinitely for a lock to be released. For example, if a transaction in one user s application were waiting for a lock being held by a transaction in another user s application to be released, and the other user left their workstation without performing some interaction that would have allowed their application to terminate the owning transaction and release all locks held, the application waiting for the lock to be released would be unable to continue processing for an indeterminable amount of time. Unfortunately, it would also be impossible terminate the application that is waiting for the lock to be released without compromising data consistency. To prevent situations like these from occurring, an important feature known as lock timeout detection has been incorporated into the DB2 Database Manager. When used, this feature prevents applications from waiting indefinitely for a lock to be released in an abnormal situation. By assigning a value to the locktimeout configuration parameter in the appropriate database configuration file, you can control if and when lock timeout detection will occur. This parameter controls the amount of time that any transaction will wait to obtain a requested lock; if the requested lock is not acquired before the time interval specified in the locktimeout configuration parameter has elapsed, the waiting application receives an error message, and the transaction requesting the lock is rolled back. (Once the transaction requesting the lock has been rolled back, the waiting application can be terminated, if so desired, without fear of causing inconsistency in the data to occur.) 43

44 Lock Conversion 44 Lock Conversion If a transaction attempts to access a data resource it already holds a lock on, and the mode of access needed requires a more restrictive lock than that already held, the DB2 Database Manager will attempt to change the state of the lock being held to the more restrictive state, rather than acquire a second lock. The operation of changing the state of a lock already held to a more restrictive state is known as lock conversion. Lock conversion occurs because a transaction can hold only one lock on a specific data resource at any given time. In most cases, lock conversion is performed on row-level locks and the conversion process is fairly straightforward. For example, if a Share (S) lock is held and an Exclusive (X) lock is needed, the Share (S) lock will be converted to an Exclusive (X) lock. However, Share (S) locks and Intent Exclusive (IX) locks are special cases, since neither lock is considered more restrictive than the other; if one of these locks is held and the other is requested, the held lock is converted to a Share With Intent Exclusive (SIX) lock. All other conversions result in the lock state requested becoming the new lock state of the lock being held -- provided the requested lock state is more restrictive that that of the current lock. (Lock conversion only occurs if a held lock can increase its restriction.) Once a lock has been converted, it stays at the highest level attained until the transaction holding the lock is terminated. 44

45 Lock Escalation 45 Lock Escalation All locks require space for storage, and because space in memory is a valuable resource, the DB2 Database Manager imposes a limit on the amount of storage space that can be used to store locks. Furthermore, the DB2 Database Manager imposes a limit on the amount of storage space each transaction can use for its own locks. Therefore, in order to prevent a specific database agent from exceeding these space limitations, a process known as lock escalation is performed whenever too many locks (regardless of their type) have been acquired. Lock escalation is the conversion of several individual row-level locks on rows within the same table into a single table-level lock. So just how does lock escalation work? When a transaction requests a lock and the lock storage space is full, one of the tables associated with the transaction is selected, a table-level lock is acquired, all row-level locks for that table are released to create space in the lock list data structure, and the table-level lock acquired is added to the lock list. If this process does not free up the storage space needed to then acquire the lock requested, another table is selected and the process is repeated, until enough free space is available at that point, the requested lock is acquired and the transaction resumes execution. However, if the necessary lock space is still unavailable after all the transaction's row-level locks have been escalated, an SQL error code is generated, all changes that have been made since the transaction was initiated are rolled back, and the transaction is terminated. Since lock escalation is handled internally, the only externally detectable result might be a reduction in concurrent access on one or more tables after the lock escalation operation has taken place provided the necessary lock space is available in the lock list data structure. Note: You can control the amount of storage that gets allocated for the lock list 45

46 Deadlocks A deadlock occurs when two or more transactions form a circle of wait states; each transaction in the circle waits for a lock held by another transaction in the circle to be released. 46 Deadlocks Earlier, we saw how one transaction wait indefinitely for a lock to be released and how this situation can be alleviated by establishing a lock timeout. However, there is one situation where contention for locks by two or more transactions cannot be resolved by specifying a lock timeout. This situation is known as a deadlock. A deadlock is more precisely referred to as a deadlock cycle, because the transactions involved form a circle of wait states; each transaction in the circle waits for a lock held by another transaction in the circle to be released. When a deadlock cycle occurs, all transactions involved will wait indefinitely for a lock to be released unless some outside agent steps in and breaks the deadlock cycle. With DB2 Universal Database, this agent is a background process, known as the deadlock detector, whose sole responsibility is to locate and resolve any deadlocks found in the locking subsystem. Each database has its own deadlock detector, which stays "asleep" most of the time but "wakes up" at preset intervals and examines the locking subsystem to determine whether a deadlock situation exists. Normally, the deadlock detector wakes up, sees that there are no deadlocks in the locking subsystem, and goes back to sleep. If, however, the deadlock detector discovers a deadlock cycle in the locking subsystem, it selects one of the transactions in the cycle to roll back and terminate. The transaction chosen receives an SQL error code, and every lock it had acquired is released. The remaining transaction(s) can then proceed because the deadlock cycle has been broken. The deadlock detector then goes back to sleep, only to wake up again at the next predefined interval, and reexamine the locking subsystem. 46

47 Deadlock Example 47 The best way to illustrate how a deadlock can occur is by example: Suppose Transaction 1 acquires an Exclusive (X) lock on Table A and Transaction 2 acquires an Exclusive (X) lock on Table B. Now, suppose Transaction 1 attempts to acquire an Exclusive (X) lock on Table B and Transaction 2 attempts to acquire an Exclusive (X) lock on Table A. Because the locks requested are incompatible with the locks being held, processing will be suspended until each transaction s second lock request is granted. However, because neither lock request can be granted until one of the owning transactions releases the lock it currently holds (by performing a commit or rollback operation), and because neither transaction can perform a commit or rollback operation because they both have been suspended (and are waiting on locks), a deadlock situation has occurred. 47

IBM A Accessment: DB Fundamentals - Assessment.

IBM A Accessment: DB Fundamentals - Assessment. IBM A2090-610 Accessment: DB2 10.1 Fundamentals - Assessment http://killexams.com/exam-detail/a2090-610 QUESTION: 130 What is the act of releasing a large number of row-level locks that an application

More information

IBM C DB Fundamentals.

IBM C DB Fundamentals. IBM C2090-610 DB2 10.1 Fundamentals http://killexams.com/exam-detail/c2090-610 QUESTION: 125 What mechanism is typically used to automatically update other tables, generate or transform values for inserted

More information

Module 15: Managing Transactions and Locks

Module 15: Managing Transactions and Locks Module 15: Managing Transactions and Locks Overview Introduction to Transactions and Locks Managing Transactions SQL Server Locking Managing Locks Introduction to Transactions and Locks Transactions Ensure

More information

Part VII Data Protection

Part VII Data Protection Part VII Data Protection Part VII describes how Oracle protects the data in a database and explains what the database administrator can do to provide additional protection for data. Part VII contains the

More information

Chapter 2. DB2 concepts

Chapter 2. DB2 concepts 4960ch02qxd 10/6/2000 7:20 AM Page 37 DB2 concepts Chapter 2 Structured query language 38 DB2 data structures 40 Enforcing business rules 49 DB2 system structures 52 Application processes and transactions

More information

Seminar 3. Transactions. Concurrency Management in MS SQL Server

Seminar 3. Transactions. Concurrency Management in MS SQL Server Seminar 3 Transactions Concurrency Management in MS SQL Server Transactions in SQL Server SQL Server uses transactions to compose multiple operations in a single unit of work. Each user's work is processed

More information

Lesson 11 Transcript: Concurrency and locking

Lesson 11 Transcript: Concurrency and locking Lesson 11 Transcript: Concurrency and locking Slide 1: Cover Welcome to Lesson 11 of the DB2 on Campus Lecture Series. We are going to talk today about concurrency and locking. My name is Raul Chong and

More information

A transaction is a sequence of one or more processing steps. It refers to database objects such as tables, views, joins and so forth.

A transaction is a sequence of one or more processing steps. It refers to database objects such as tables, views, joins and so forth. 1 2 A transaction is a sequence of one or more processing steps. It refers to database objects such as tables, views, joins and so forth. Here, the following properties must be fulfilled: Indivisibility

More information

Introduction to Databases, Fall 2005 IT University of Copenhagen. Lecture 10: Transaction processing. November 14, Lecturer: Rasmus Pagh

Introduction to Databases, Fall 2005 IT University of Copenhagen. Lecture 10: Transaction processing. November 14, Lecturer: Rasmus Pagh Introduction to Databases, Fall 2005 IT University of Copenhagen Lecture 10: Transaction processing November 14, 2005 Lecturer: Rasmus Pagh Today s lecture Part I: Transaction processing Serializability

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

Database Administration and Tuning

Database 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 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 Chapter 11. Class 9: Transaction Management 1

Transaction Management Chapter 11. Class 9: Transaction Management 1 Transaction Management Chapter 11 Class 9: Transaction Management 1 The Concurrent Update Problem To prevent errors from being introduced when concurrent updates are attempted, the application logic must

More information

Chapter 13. Concurrency Control. In This Chapter. c Concurrency Models c Transactions c Locking c Isolation Levels c Row Versioning

Chapter 13. Concurrency Control. In This Chapter. c Concurrency Models c Transactions c Locking c Isolation Levels c Row Versioning Chapter 13 Concurrency Control In This Chapter c Concurrency Models c Transactions c Locking c Isolation Levels c Row Versioning 360 Microsoft SQL Server 2012: A Beginner s Guide As you already know, data

More information

Databases - Transactions

Databases - Transactions Databases - Transactions Gordon Royle School of Mathematics & Statistics University of Western Australia Gordon Royle (UWA) Transactions 1 / 34 ACID ACID is the one acronym universally associated with

More information

A can be implemented as a separate process to which transactions send lock and unlock requests The lock manager replies to a lock request by sending a lock grant messages (or a message asking the transaction

More information

Announcements. SQL: Part IV. Transactions. Summary of SQL features covered so far. Fine prints. SQL transactions. Reading assignments for this week

Announcements. SQL: Part IV. Transactions. Summary of SQL features covered so far. Fine prints. SQL transactions. Reading assignments for this week Announcements 2 SQL: Part IV CPS 216 Advanced Database Systems Reading assignments for this week A Critique of ANSI SQL Isolation Levels, by Berenson et al. in SIGMOD 1995 Weaving Relations for Cache Performance,

More information

Transactions and Isolation

Transactions and Isolation Transactions and Isolation Tom Kelliher, CS 318 Apr. 29, 2002 1 Administrivia Announcements Normal form analyses due Wednesday. Toolboxes and projects due Friday. Review for final on Friday. Course evaluation

More information

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 13 Managing Transactions and Concurrency

Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition. Chapter 13 Managing Transactions and Concurrency Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition Chapter 13 Managing Transactions and Concurrency Objectives In this chapter, you will learn: What a database transaction

More information

Chapter 7 (Cont.) Transaction Management and Concurrency Control

Chapter 7 (Cont.) Transaction Management and Concurrency Control Chapter 7 (Cont.) Transaction Management and Concurrency Control In this chapter, you will learn: What a database transaction is and what its properties are What concurrency control is and what role it

More information

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe CHAPTER 20 Introduction to Transaction Processing Concepts and Theory Introduction Transaction Describes local unit of database processing Transaction processing systems Systems with large databases and

More information

CS352 Lecture - Concurrency

CS352 Lecture - Concurrency CS352 Lecture - Concurrency Objectives: Last revised 3/21/17 1. To introduce locking as a means of preserving the serializability of concurrent schedules. 2. To briefly introduce other approaches to this

More information

Information Systems (Informationssysteme)

Information Systems (Informationssysteme) Information Systems (Informationssysteme) Jens Teubner, TU Dortmund jens.teubner@cs.tu-dortmund.de Summer 2016 c Jens Teubner Information Systems Summer 2016 1 Part VIII Transaction Management c Jens Teubner

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

CS352 Lecture - Concurrency

CS352 Lecture - Concurrency CS352 Lecture - Concurrency Objectives: Last revised 11/16/06 1. To introduce locking as a means of preserving the serializability of concurrent schedules. 2. To briefly introduce other approaches to this

More information

CMP-3440 Database Systems

CMP-3440 Database Systems CMP-3440 Database Systems Concurrency Control with Locking, Serializability, Deadlocks, Database Recovery Management Lecture 10 zain 1 Basic Recovery Facilities Backup Facilities: provides periodic backup

More information

Databases - Transactions II. (GF Royle, N Spadaccini ) Databases - Transactions II 1 / 22

Databases - Transactions II. (GF Royle, N Spadaccini ) Databases - Transactions II 1 / 22 Databases - Transactions II (GF Royle, N Spadaccini 2006-2010) Databases - Transactions II 1 / 22 This lecture This lecture discusses how a DBMS schedules interleaved transactions to avoid the anomalies

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

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

SQL: Transactions. Introduction to Databases CompSci 316 Fall 2017

SQL: Transactions. Introduction to Databases CompSci 316 Fall 2017 SQL: Transactions Introduction to Databases CompSci 316 Fall 2017 2 Announcements (Tue., Oct. 17) Midterm graded Sample solution already posted on Sakai Project Milestone #1 feedback by email this weekend

More information

Locking, concurrency, and isolation

Locking, concurrency, and isolation Holdable result sets and autocommit When autocommit is on, a positioned update or delete statement will automatically cause the transaction to commit. If the result set has holdability ResultSet.CLOSE_CURSORS_AT_COMMIT,

More information

Transactions. Kathleen Durant PhD Northeastern University CS3200 Lesson 9

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

SQL: Transactions. Announcements (October 2) Transactions. CPS 116 Introduction to Database Systems. Project milestone #1 due in 1½ weeks

SQL: Transactions. Announcements (October 2) Transactions. CPS 116 Introduction to Database Systems. Project milestone #1 due in 1½ weeks SQL: Transactions CPS 116 Introduction to Database Systems Announcements (October 2) 2 Project milestone #1 due in 1½ weeks Come to my office hours if you want to chat about project ideas Midterm in class

More information

2 nd Semester 2009/2010

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

bobpusateri.com heraflux.com linkedin.com/in/bobpusateri. Solutions Architect

bobpusateri.com heraflux.com linkedin.com/in/bobpusateri. Solutions Architect 1 @sqlbob bobpusateri.com heraflux.com linkedin.com/in/bobpusateri Specialties / Focus Areas / Passions: Performance Tuning & Troubleshooting Very Large Databases SQL Server Storage Engine High Availability

More information

Schedule. Today: Feb. 21 (TH) Feb. 28 (TH) Feb. 26 (T) Mar. 5 (T) Read Sections , Project Part 6 due.

Schedule. Today: Feb. 21 (TH) Feb. 28 (TH) Feb. 26 (T) Mar. 5 (T) Read Sections , Project Part 6 due. Schedule Today: Feb. 21 (TH) Transactions, Authorization. Read Sections 8.6-8.7. Project Part 5 due. Feb. 26 (T) Datalog. Read Sections 10.1-10.2. Assignment 6 due. Feb. 28 (TH) Datalog and SQL Recursion,

More information

CSE 444: Database Internals. Lectures Transactions

CSE 444: Database Internals. Lectures Transactions CSE 444: Database Internals Lectures 13-14 Transactions CSE 444 - Spring 2014 1 Announcements Lab 2 is due TODAY Lab 3 will be released today, part 1 due next Monday HW4 is due on Wednesday HW3 will be

More information

CPS352 Lecture - The Transaction Concept

CPS352 Lecture - The Transaction Concept Objectives: CPS352 Lecture - The Transaction Concept Last Revised March 3, 2017 1. To introduce the notion of a transaction and the ACID properties of a transaction 2. To introduce the notion of the state

More information

PL/SQL Block structure

PL/SQL Block structure PL/SQL Introduction Disadvantage of SQL: 1. SQL does t have any procedural capabilities. SQL does t provide the programming technique of conditional checking, looping and branching that is vital for data

More information

Vendor: IBM. Exam Code: C Exam Name: DB Fundamentals. Version: Demo

Vendor: IBM. Exam Code: C Exam Name: DB Fundamentals. Version: Demo Vendor: IBM Exam Code: C2090-610 Exam Name: DB2 10.1 Fundamentals Version: Demo QUESTION 1 If the following command is executed: CREATE DATABASE test What is the page size (in kilobytes) of the database?

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

PROCEDURAL DATABASE PROGRAMMING ( PL/SQL AND T-SQL)

PROCEDURAL DATABASE PROGRAMMING ( PL/SQL AND T-SQL) Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 10 Database Programming PROCEDURAL DATABASE PROGRAMMING ( PL/SQL AND T-SQL) AGENDA 14. Advanced Topics 14.1 Optimistic/Pessimistic

More information

Weak Levels of Consistency

Weak Levels of Consistency Weak Levels of Consistency - Some applications are willing to live with weak levels of consistency, allowing schedules that are not serialisable E.g. a read-only transaction that wants to get an approximate

More information

Chapter 22. Transaction Management

Chapter 22. Transaction Management Chapter 22 Transaction Management 1 Transaction Support Transaction Action, or series of actions, carried out by user or application, which reads or updates contents of database. Logical unit of work on

More information

Introduction to Transaction Processing Concepts and Theory

Introduction to Transaction Processing Concepts and Theory Chapter 4 Introduction to Transaction Processing Concepts and Theory Adapted from the slides of Fundamentals of Database Systems (Elmasri et al., 2006) 1 Chapter Outline Introduction to Transaction Processing

More information

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

Advanced Databases. Transactions. Nikolaus Augsten. FB Computerwissenschaften Universität Salzburg Advanced Databases Transactions Nikolaus Augsten nikolaus.augsten@sbg.ac.at FB Computerwissenschaften Universität Salzburg Version October 18, 2017 Wintersemester 2017/18 Adapted from slides for textbook

More information

CS352 Lecture - The Transaction Concept

CS352 Lecture - The Transaction Concept CS352 Lecture - The Transaction Concept Last Revised 11/7/06 Objectives: 1. To introduce the notion of a transaction and the ACID properties of a transaction 2. To introduce the notion of the state of

More information

Transactions. ACID Properties of Transactions. Atomicity - all or nothing property - Fully performed or not at all

Transactions. ACID Properties of Transactions. Atomicity - all or nothing property - Fully performed or not at all Transactions - An action, or series of actions, carried out by a single user or application program, which reads or updates the contents of the database - Logical unit of work on the database - Usually

More information

Introduction to Data Management CSE 344

Introduction to Data Management CSE 344 Introduction to Data Management CSE 344 Unit 7: Transactions Schedules Implementation Two-phase Locking (3 lectures) 1 Class Overview Unit 1: Intro Unit 2: Relational Data Models and Query Languages Unit

More information

Database Application Development Oracle PL/SQL, part 2. CS430/630 Lecture 18b

Database Application Development Oracle PL/SQL, part 2. CS430/630 Lecture 18b Database Application Development Oracle PL/SQL, part 2 CS430/630 Lecture 18b Murach Chapter 14 How to manage transactions and locking PL/SQL, C14 2014, Mike Murach & Associates, Inc. Slide 2 Objectives

More information

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

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

Transactions Transaction Isolation levels locks Locks Types of Locks Shared Locks(S)

Transactions Transaction Isolation levels locks Locks Types of Locks Shared Locks(S) Transactions Transaction: When you give something to me, and I take it; then it s a transaction. When you withdraw money from an ATM machine, and you receive the money; then it is also a kind of transaction.

More information

Overview. Introduction to Transaction Management ACID. Transactions

Overview. Introduction to Transaction Management ACID. Transactions Introduction to Transaction Management UVic C SC 370 Dr. Daniel M. German Department of Computer Science Overview What is a transaction? What properties transactions have? Why do we want to interleave

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

C Examcollection.Premium.Exam.58q

C Examcollection.Premium.Exam.58q C2090-610.Examcollection.Premium.Exam.58q Number: C2090-610 Passing Score: 800 Time Limit: 120 min File Version: 32.2 http://www.gratisexam.com/ Exam Code: C2090-610 Exam Name: DB2 10.1 Fundamentals Visualexams

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

Lecture 21 Concurrency Control Part 1

Lecture 21 Concurrency Control Part 1 CMSC 461, Database Management Systems Spring 2018 Lecture 21 Concurrency Control Part 1 These slides are based on Database System Concepts 6 th edition book (whereas some quotes and figures are used from

More information

CSE 344 MARCH 9 TH TRANSACTIONS

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

Introduction to Data Management CSE 414

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

DATABASE TRANSACTIONS. CS121: Relational Databases Fall 2017 Lecture 25

DATABASE TRANSACTIONS. CS121: Relational Databases Fall 2017 Lecture 25 DATABASE TRANSACTIONS CS121: Relational Databases Fall 2017 Lecture 25 Database Transactions 2 Many situations where a sequence of database operations must be treated as a single unit A combination of

More information

WHEN is used to specify rows that meet a criteria such as: WHEN (EMP_SALARY < 90000). SELECT and SUBSET are invalid clauses and would cause an error.

WHEN is used to specify rows that meet a criteria such as: WHEN (EMP_SALARY < 90000). SELECT and SUBSET are invalid clauses and would cause an error. 1. Suppose you have created a test version of a production table, and you want to to use the UNLOAD utility to extract the first 5,000 rows from the production table to load to the test version. Which

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

Security Mechanisms I. Key Slide. Key Slide. Security Mechanisms III. Security Mechanisms II

Security Mechanisms I. Key Slide. Key Slide. Security Mechanisms III. Security Mechanisms II Database Facilities One of the main benefits from centralising the implementation data model of a DBMS is that a number of critical facilities can be programmed once against this model and thus be available

More information

Transaction Management

Transaction Management Transaction Management Imran Khan FCS, IBA In this chapter, you will learn: What a database transaction is and what its properties are How database transactions are managed What concurrency control is

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

Concurrency, Mutual Exclusion and Synchronization C H A P T E R 5

Concurrency, Mutual Exclusion and Synchronization C H A P T E R 5 Concurrency, Mutual Exclusion and Synchronization C H A P T E R 5 Multiple Processes OS design is concerned with the management of processes and threads: Multiprogramming Multiprocessing Distributed processing

More information

Database Systems CSE 414

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

The tracing tool in SQL-Hero tries to deal with the following weaknesses found in the out-of-the-box SQL Profiler tool:

The tracing tool in SQL-Hero tries to deal with the following weaknesses found in the out-of-the-box SQL Profiler tool: Revision Description 7/21/2010 Original SQL-Hero Tracing Introduction Let s start by asking why you might want to do SQL tracing in the first place. As it turns out, this can be an extremely useful activity

More information

Vendor: IBM. Exam Code: Exam Name: DB Fundamentals. Version: DEMO

Vendor: IBM. Exam Code: Exam Name: DB Fundamentals. Version: DEMO Vendor: IBM Exam Code: 000-610 Exam Name: DB2 10.1 Fundamentals Version: DEMO QUESTION 1 What is the act of exchanging one lock an application holds on a resource for a more restrictive lock on the same

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

Concurrency Control. Transaction Management. Lost Update Problem. Need for Concurrency Control. Concurrency control

Concurrency Control. Transaction Management. Lost Update Problem. Need for Concurrency Control. Concurrency control Concurrency Control Process of managing simultaneous operations on the database without having them interfere with one another. Transaction Management Concurrency control Connolly & Begg. Chapter 19. Third

More information

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

CSC 261/461 Database Systems Lecture 21 and 22. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101 CSC 261/461 Database Systems Lecture 21 and 22 Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101 Announcements Project 3 (MongoDB): Due on: 04/12 Work on Term Project and Project 1 The last (mini)

More information

Chapter 13 : Concurrency Control

Chapter 13 : Concurrency Control Chapter 13 : Concurrency Control Chapter 13: Concurrency Control Lock-Based Protocols Timestamp-Based Protocols Validation-Based Protocols Multiple Granularity Multiversion Schemes Insert and Delete Operations

More information

! A lock is a mechanism to control concurrent access to a data item! Data items can be locked in two modes :

! A lock is a mechanism to control concurrent access to a data item! Data items can be locked in two modes : Lock-Based Protocols Concurrency Control! A lock is a mechanism to control concurrent access to a data item! Data items can be locked in two modes : 1 exclusive (X) mode Data item can be both read as well

More information

Lock Tuning. Concurrency Control Goals. Trade-off between correctness and performance. Correctness goals. Performance goals.

Lock Tuning. Concurrency Control Goals. Trade-off between correctness and performance. Correctness goals. Performance goals. Lock Tuning Concurrency Control Goals Performance goals Reduce blocking One transaction waits for another to release its locks Avoid deadlocks Transactions are waiting for each other to release their locks

More information

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 17-1

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 17-1 Slide 17-1 Chapter 17 Introduction to Transaction Processing Concepts and Theory Chapter Outline 1 Introduction to Transaction Processing 2 Transaction and System Concepts 3 Desirable Properties of Transactions

More information

Lecture 13 Concurrency Control

Lecture 13 Concurrency Control Lecture 13 Concurrency Control Shuigeng Zhou December 23, 2009 School of Computer Science Fudan University Outline Lock-Based Protocols Multiple Granularity Deadlock Handling Insert and Delete Operations

More information

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI Department of Computer Science and Engineering CS6302- DATABASE MANAGEMENT SYSTEMS Anna University 2 & 16 Mark Questions & Answers Year / Semester: II / III

More information

Transactions and Locking. Rose-Hulman Institute of Technology Curt Clifton

Transactions and Locking. Rose-Hulman Institute of Technology Curt Clifton Transactions and Locking Rose-Hulman Institute of Technology Curt Clifton Outline ACID Transactions COMMIT and ROLLBACK Managing Transactions Locks The Setting Database systems are normally being accessed

More information

Concurrency Control & Recovery

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

Example: Transfer Euro 50 from A to B

Example: Transfer Euro 50 from A to B TRANSACTIONS Example: Transfer Euro 50 from A to B 1. Read balance of A from DB into Variable a: read(a,a); 2. Subtract 50.- Euro from the balance: a:= a 50; 3. Write new balance back into DB: write(a,a);

More information

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

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

Graph-based protocols are an alternative to two-phase locking Impose a partial ordering on the set D = {d 1, d 2,..., d h } of all data items.

Graph-based protocols are an alternative to two-phase locking Impose a partial ordering on the set D = {d 1, d 2,..., d h } of all data items. Graph-based protocols are an alternative to two-phase locking Impose a partial ordering on the set D = {d 1, d 2,..., d h } of all data items. If d i d j then any transaction accessing both d i and d j

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

JDBC, Transactions. Niklas Fors JDBC 1 / 38

JDBC, Transactions. Niklas Fors JDBC 1 / 38 JDBC, Transactions SQL in Programs Embedded SQL and Dynamic SQL JDBC Drivers, Connections, Statements, Prepared Statements Updates, Queries, Result Sets Transactions Niklas Fors (niklas.fors@cs.lth.se)

More information

Into into Locking and Blocking. Dmitri Korotkevitch (http://aboutsqlserver.com) 1

Into into Locking and Blocking. Dmitri Korotkevitch (http://aboutsqlserver.com) 1 Into into Locking and Blocking Dmitri Korotkevitch (http://aboutsqlserver.com) 1 About me 20 years of experience in IT 14+ years of experience working with Microsoft SQL Server Microsoft SQL Server MVP

More information

Deadlocks were detected. Deadlocks were detected in the DB2 interval statistics data.

Deadlocks were detected. Deadlocks were detected in the DB2 interval statistics data. Rule DB2-311: Deadlocks were detected Finding: Deadlocks were detected in the DB2 interval statistics data. Impact: This finding can have a MEDIUM IMPACT, or HIGH IMPACT on the performance of the DB2 subsystem.

More information

Concurrency Control. Data Base Management Systems. Inherently Concurrent Systems: The requirements

Concurrency Control. Data Base Management Systems. Inherently Concurrent Systems: The requirements Concurrency Control Inherently Concurrent Systems: These are Systems that respond to and manage simultaneous activities in their external environment which are inherently concurrent and maybe broadly classified

More information

Database Systemer, Forår 2006 IT Universitet i København. Lecture 10: Transaction processing. 6 april, Forelæser: Esben Rune Hansen

Database Systemer, Forår 2006 IT Universitet i København. Lecture 10: Transaction processing. 6 april, Forelæser: Esben Rune Hansen Database Systemer, Forår 2006 IT Universitet i København Lecture 10: Transaction processing 6 april, 2006 Forelæser: Esben Rune Hansen Today s lecture Part I: Transaction processing Serializability and

More information

Transaction Processing Concepts and Theory. Truong Tuan Anh CSE-HCMUT

Transaction Processing Concepts and Theory. Truong Tuan Anh CSE-HCMUT 1 Transaction Processing Concepts and Theory Truong Tuan Anh CSE-HCMUT 2 Outline Introduction to Transaction Processing Transaction and System Concepts Desirable Properties of Transactions Characterizing

More information

Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Slide 17-1

Copyright 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Slide 17-1 Slide 17-1 Chapter 17 Introduction to Transaction Processing Concepts and Theory Multi-user processing and concurrency Simultaneous processing on a single processor is an illusion. When several users are

More information

Database Usage (and Construction)

Database Usage (and Construction) Lecture 10 Database Usage (and Construction) Transactions Setting DBMS must allow concurrent access to databases. Imagine a bank where account information is stored in a database not allowing concurrent

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

CSE 344 MARCH 25 TH ISOLATION

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

Introducing Transactions

Introducing Transactions We have so far interactively executed several SQL statements that have performed various actions in your MySQL database. The statements were run in an isolated environment one statement at a time, with

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) DBMS Internals- Part XI Lecture 19, April 2, 2014 Mohammad Hammoud Today Last Session: DBMS Internals- Part IX Query Optimization (Cont d) A Very Brief Introduction to Transaction

More information

Chapter 12 : Concurrency Control

Chapter 12 : Concurrency Control Chapter 12 : Concurrency Control Chapter 12: Concurrency Control Lock-Based Protocols Timestamp-Based Protocols Validation-Based Protocols Multiple Granularity Multiversion Schemes Insert and Delete Operations

More information

CSE 530A ACID. Washington University Fall 2013

CSE 530A ACID. Washington University Fall 2013 CSE 530A ACID Washington University Fall 2013 Concurrency Enterprise-scale DBMSs are designed to host multiple databases and handle multiple concurrent connections Transactions are designed to enable Data

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

CSE 344 MARCH 5 TH TRANSACTIONS

CSE 344 MARCH 5 TH TRANSACTIONS CSE 344 MARCH 5 TH TRANSACTIONS ADMINISTRIVIA OQ6 Out 6 questions Due next Wednesday, 11:00pm HW7 Shortened Parts 1 and 2 -- other material candidates for short answer, go over in section Course evaluations

More information