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

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

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

Outline. Optimistic CC (Kung&Robinson) Carnegie Mellon Univ. Dept. of Computer Science Database Applications

Concurrency Control. Conflict Serializable Schedules. Example. Chapter 17

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

Today s Class. Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Formal Properties of Schedules. Conflicting Operations

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

Concurrency Control CHAPTER 17 SINA MERAJI

Concurrency Control. R &G - Chapter 19

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

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

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

Database Systems CSE 414

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

Introduction to Data Management CSE 344

Introduction to Data Management CSE 414

Introduction to Data Management CSE 344

Implementing Isolation

Introduction to Database Systems CSE 444

CS 448 Database Systems. Serializability Issues

CS 541 Database Systems. Serializability Issues

Database Systems CSE 414

Concurrency control 12/1/17

Optimistic Concurrency Control. April 18, 2018

Lock-based concurrency control. Q: What if access patterns rarely, if ever, conflict? Serializability. Concurrency Control II (OCC, MVCC)

Optimistic Concurrency Control. April 13, 2017

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

6.830 Lecture Recovery 10/30/2017

CSE 344 MARCH 25 TH ISOLATION

Chapter 13 : Concurrency Control

Intro to Transaction Management

Chapter 15 : Concurrency Control

Lecture 5: Transactions Concurrency Control. Wednesday October 26 th, 2011

Overview. Introduction to Transaction Management ACID. Transactions

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

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

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

Phantom Problem. Phantom Problem. Phantom Problem. Phantom Problem R1(X1),R1(X2),W2(X3),R1(X1),R1(X2),R1(X3) R1(X1),R1(X2),W2(X3),R1(X1),R1(X2),R1(X3)

CSE 530A ACID. Washington University Fall 2013

Concurrency Control Overview. COSC 404 Database System Implementation. Concurrency Control. Lock-Based Protocols. Lock-Based Protocols (2)

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

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

CSE 444: Database Internals. Lectures 13 Transaction Schedules

CMU SCS CMU SCS Who: What: When: Where: Why: CMU SCS

CSE 344 MARCH 9 TH TRANSACTIONS

Lecture 7: Transactions Concurrency Control

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

Lecture 22 Concurrency Control Part 2

Pessimistic v.s. Optimistic. Outline. Timestamps. Timestamps. Timestamps. CSE 444: Database Internals. Main invariant:

Transactions. Kathleen Durant PhD Northeastern University CS3200 Lesson 9

Chapter 12 : Concurrency Control

6.830 Lecture Recovery 10/30/2017

Transaction Processing: Basics - Transactions

12.3 Nonlocking schedulers. Timestamp ordering. TO concurrency control guarantees conflict-serializable schedules

DATABASE TRANSACTIONS. CS121: Relational Databases Fall 2017 Lecture 25

Concurrency Control. Concurrency Control Ensures interleaving of operations amongst concurrent transactions result in serializable schedules

Database Systems. Announcement

CSE544 Transac-ons: Concurrency Control. Lectures #5-6 Thursday, January 20, 2011 Tuesday, January 25, 2011

Rethinking Serializable Multi-version Concurrency Control. Jose Faleiro and Daniel Abadi Yale University

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

Chapter 10 : Concurrency Control

CSE 444: Database Internals. Lectures Transactions

Chapter 16 : Concurrency Control

Comp 5311 Database Management Systems. 14. Timestamp-based Protocols

Introduction to Database Systems CSE 444

Transaction Management: Concurrency Control

TicToc: Time Traveling Optimistic Concurrency Control

Database transactions

doc. RNDr. Tomáš Skopal, Ph.D.

Concurrency control CS 417. Distributed Systems CS 417


Unit 10.5 Transaction Processing: Concurrency Zvi M. Kedem 1

CSC 261/461 Database Systems Lecture 24

Multi-User-Synchronization

References. Concurrency Control. Administração e Optimização de Bases de Dados 2012/2013. Helena Galhardas e

Concurrency Control 9-1

TRANSACTION MANAGEMENT

Seminar 3. Transactions. Concurrency Management in MS SQL Server

Isolation levels. Introduction to Database Design 2012, Lecture 14. Rasmus Ejlers Møgelberg. Questions class about one week before exam

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

CS Reading Packet: "Transaction management, part 2"

DB2 Lecture 10 Concurrency Control

Concurrency Control & Recovery

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

How Oracle Does It. No Read Locks

Chapter 10: Concurrency Control! Chapter 10 : Concurrency Control! Intuition of Lock-based Protocols! Lock-Based Protocols!

Chapter 10 : Concurrency Control!

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

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Lecture 21. Lecture 21: Concurrency & Locking

CSE 344 MARCH 5 TH TRANSACTIONS

14 Concurrency control

h p:// Authors: Tomáš Skopal, Irena Holubová Lecturer: Mar n Svoboda, mar

Outline. Review questions. Carnegie Mellon Univ. Dept. of Computer Science Database Applications

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

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

Advances in Data Management Transaction Management A.Poulovassilis

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

Transaction Management: Introduction (Chap. 16)

Transactions and Concurrency Control

Transcription:

Last Class Carnegie Mellon Univ. Dept. of Computer Science 15-415/615 - DB Applications C. Faloutsos A. Pavlo Lecture#23: Concurrency Control Part 2 (R&G ch. 17) Serializability Two-Phase Locking Deadlocks Lock Granularities Faloutsos/Pavlo 15-415/615 2 Concurrency Control Approaches Today's Class Two-Phase Locking (2PL) Determine serializability order of conflicting operations at runtime while txns execute. Timestamp Ordering (T/O) Determine serializability order of txns before they execute. Basic Timestamp Ordering Optimistic Concurrency Control Multi-Version Concurrency Control The Phantom Problem Weaker Isolation Levels Faloutsos/Pavlo 15-415/615 3 Faloutsos/Pavlo 15-415/615 4

Timestamp Allocation T/O Concurrency Control Each txn T i is assigned a unique fixed timestamp that is monotonically increasing. Let TS(T i ) be the timestamp allocated to txn T i Different schemes assign timestamps at different times during the txn. Multiple implementation strategies: System Clock. Logical Counter. Hybrid. Faloutsos/Pavlo 15-415/615 5 Use these timestamps to determine the serializability order. If TS(T i ) < TS(T j ), then the DBMS must ensure that the execution schedule is equivalent to a serial schedule where T i appears before T j. Faloutsos/Pavlo 15-415/615 6 Basic T/O Basic T/O Reads Txns read and write objects without locks. Every object X is tagged with timestamp of the last txn that successfully did read/write: W-TS(X) Write timestamp on X R-TS(X) Read timestamp on X Check timestamps for every operation: If txn tries to access an object from the future, it aborts and restarts. If TS(T i ) < W-TS(X), this violates timestamp order of T i w.r.t. writer of X. Abort T i and restart it (with same TS? why?) Else: Allow T i to read X. Update R-TS(X) to max(r-ts(x), TS(T i )) Have to make a local copy of X to ensure repeatable reads for T i. Faloutsos/Pavlo 15-415/615 7 Faloutsos/Pavlo 15-415/615 8

Basic T/O Writes If TS(T i ) < R-TS(X) or TS(T i ) < W-TS(X) Abort and restart T i. Else: Allow T i to write X and update W-TS(X) Also have to make a local copy of X to ensure repeatable reads for T i. Basic T/O Example #1 TS()=1 TS()=2 W(B) A 0 0 B 0 0 Faloutsos/Pavlo 15-415/615 9 Faloutsos/Pavlo 15-415/615 10 Basic T/O Example #1 TS()=1 TS()=2 W(B) A 0 0 B 10 0 Basic T/O Example #1 TS()=1 TS()=2 W(B) A 0 0 B 12 0 0 Faloutsos/Pavlo 15-415/615 10 Faloutsos/Pavlo 15-415/615 10

Basic T/O Example #1 TS()=1 TS()=2 W(B) A 0 0 B 12 0 20 Basic T/O Example #1 TS()=1 TS()=2 W(B) A 10 0 B 12 0 20 Faloutsos/Pavlo 15-415/615 10 Faloutsos/Pavlo 15-415/615 10 Basic T/O Example #1 TS()=1 TS()=2 W(B) A 12 0 0 B 12 0 20 Basic T/O Example #1 TS()=1 TS()=2 W(B) A 12 0 20 B 12 0 20 Faloutsos/Pavlo 15-415/615 10 Faloutsos/Pavlo 15-415/615 10

Basic T/O Example #1 TS()=1 TS()=2 W(B) A 12 0 20 B 12 0 20 No violations so both txns are safe to commit. Basic T/O Example #2 A 0 0 Faloutsos/Pavlo 15-415/615 10 Faloutsos/Pavlo 15-415/615 11 Basic T/O Example #2 A 10 0 Basic T/O Example #2 A 10 20 Faloutsos/Pavlo 15-415/615 11 Faloutsos/Pavlo 15-415/615 11

Basic T/O Example #2 cannot overwrite update by, so it has to abort+restart. A 10 20 Violation: TS() < W-TS(A) Basic T/O Thomas Write Rule If TS(T i ) < R-TS(X): Abort and restart T i. If TS(T i ) < W-TS(X): Thomas Write Rule: Ignore the write and allow the txn to continue. This violates timestamp order of T i Else: Allow T i to write X and update W-TS(X) Faloutsos/Pavlo 15-415/615 11 Faloutsos/Pavlo 15-415/615 12 Basic T/O Thomas Write Rule A - - Basic T/O Thomas Write Rule A 1 - - Faloutsos/Pavlo 15-415/615 13 Faloutsos/Pavlo 15-415/615 13

Basic T/O Thomas Write Rule A 1-2 - Basic T/O Thomas Write Rule Ignore the write and allow to commit. A 1-2 - We do not update W-TS(A) Faloutsos/Pavlo 15-415/615 13 Faloutsos/Pavlo 15-415/615 13 Basic T/O Recoverable s Ensures conflict serializability if you don t use the Thomas Write Rule. No deadlocks because no txn ever waits. Possibility of starvation for long txns if short txns keep causing conflicts. Permits schedules that are not recoverable. Transactions commit only after all transactions whose changes they read, commit. Faloutsos/Pavlo 15-415/615 14 Faloutsos/Pavlo 15-415/615 15

Recoverability Today's Class ABORT W(B) aborts after has committed. is allowed to read the writes of. This is not recoverable because we can t restart. Basic Timestamp Ordering Optimistic Concurrency Control Multi-Version Concurrency Control The Phantom Problem Weaker Isolation Levels Faloutsos/Pavlo 15-415/615 16 Faloutsos/Pavlo 15-415/615 17 Optimistic Concurrency Control OCC Phases Assumption: Conflicts are rare Forcing txns to wait to acquire locks adds a lot of overhead. Optimize for the no-conflict case. Read: Track the read/write sets of txns and store their writes in a private workspace. Validation: When a txn commits, check whether it conflicts with other txns. Write: If validation succeeds, apply private changes to database. Otherwise abort and restart the txn. Faloutsos/Pavlo 15-415/615 18 Faloutsos/Pavlo 15-415/615 19

OCC Example OCC Example Workspace Faloutsos/Pavlo 15-415/615 20 Faloutsos/Pavlo 15-415/615 20 OCC Example Workspace - A - 123-0 OCC Example Workspace - A - 123-0 Workspace Faloutsos/Pavlo 15-415/615 20 Faloutsos/Pavlo 15-415/615 20

OCC Example Workspace Workspace - A - 123-0 - A - 123-0 OCC Example TS()=1 Workspace Workspace - A - 123-0 - A - 123-0 Faloutsos/Pavlo 15-415/615 20 Faloutsos/Pavlo 15-415/615 20 OCC Example TS()=1 Workspace Workspace - A - 123-0 - A - 123-0 OCC Example TS()=1 Workspace - A - 123-0 Faloutsos/Pavlo 15-415/615 20 Faloutsos/Pavlo 15-415/615 20

OCC Example TS()=1 Workspace - A - 123 456-0 OCC Example TS()=2 TS()=1 Workspace - A - 123 456-01 Faloutsos/Pavlo 15-415/615 20 Faloutsos/Pavlo 15-415/615 20 OCC Example TS()=2 TS()=1 A 456 123 20 Workspace - A - 123 456-01 OCC Validation Phase Need to guarantee only serializable schedules are permitted. At validation, T i checks other txns for RW and WW conflicts and makes sure that all conflicts go one way (from older txns to younger txns). Faloutsos/Pavlo 15-415/615 20 Faloutsos/Pavlo 15-415/615 21

OCC Serial Validation OCC Validation Phase Maintain global view of all active txns. Record read set and write set while txns are running and write into private workspace. Execute Validation and Write phase inside a protected critical section. Each txn s timestamp is assigned at the beginning of the validation phase. Check the timestamp ordering of the committing txn with all other running txns. If TS(T i ) < TS(T j ), then one of the following three conditions must hold Faloutsos/Pavlo 15-415/615 22 Faloutsos/Pavlo 15-415/615 23 OCC Validation #1 OCC Validation #1 T i completes all three phases before T j begins. Faloutsos/Pavlo 15-415/615 24 Faloutsos/Pavlo 15-415/615 25

OCC Validation #2 T i completes before T j starts its Write phase, and T i does not write to any object read by T j. WriteSet(T i ) ReadSet(T j ) = Ø Faloutsos/Pavlo 15-415/615 26 OCC Validation #2 has to abort even though will never write to the database. Workspace Workspace - A - 123 456-0 - A - 123-0 Faloutsos/Pavlo 15-415/615 27 OCC Validation #2 Safe to commit because we know that will not write. Workspace Workspace - A - 123 456-0 - A - 123-0 Faloutsos/Pavlo 15-415/615 28 OCC Validation #3 T i completes its Read phase before T j completes its Read phase And T i does not write to any object that is either read or written by T j : WriteSet(T i ) ReadSet(T j ) = Ø WriteSet(T i ) WriteSet(T j ) = Ø Faloutsos/Pavlo 15-415/615 29

OCC Validation #3 B XYZ 0 Workspace Workspace - A - 123 456-0 - B - XYZ - 0 OCC Validation #3 TS()=1 Safe to commit because sees the DB after has executed. A 456 123 10 B XYZ 0 Workspace Workspace - A - 123 456-0 - B - XYZ - 0 Faloutsos/Pavlo 15-415/615 30 Faloutsos/Pavlo 15-415/615 30 OCC Validation #3 A 456 123 10 B XYZ 0 Workspace - B - XYZ - 0 - A - 456-1 OCC Observations Q: When does OCC work well? A: When # of conflicts is low: All txns are read-only (ideal). Txns access disjoint subsets of data. If the database is large and the workload is not skewed, then there is a low probability of conflict, so again locking is wasteful. Faloutsos/Pavlo 15-415/615 30 Faloutsos/Pavlo 15-415/615 31

OCC Performance Issues Today's Class High overhead for copying data locally. Validation/Write phase bottlenecks. Aborts are more wasteful because they only occur after a txn has already executed. Suffers from timestamp allocation bottleneck. Basic Timestamp Ordering Optimistic Concurrency Control Multi-Version Concurrency Control The Phantom Problem Weaker Isolation Levels Faloutsos/Pavlo 15-415/615 32 Faloutsos/Pavlo 15-415/615 33 Multi-Version Concurrency Control MVCC Reads Writes create new versions of objects instead of in-place updates: Each successful write results in the creation of a new version of the data item written. Use write timestamps to label versions. Let X k denote the version of X where for a given txn T i : W-TS(X k ) TS(T i ) Any read operation sees the latest version of an object from right before that txn started. Every read request can be satisfied without blocking the txn. If TS(T i ) > R-TS(X k ): Set R-TS(X k ) = TS(T i ) Faloutsos/Pavlo 15-415/615 34 Faloutsos/Pavlo 15-415/615 35

MVCC Writes If TS(T i ) < R-TS(X k ): Abort and restart T i. If TS(T i ) = W-TS(X k ): Overwrite the contents of X k. Else: Create a new version of X k+1 and set its write timestamp to TS(T i ). MVCC Example #1 TS()=1 TS()=2 Object Value R-TS W-TS A 0 123 0 0 - - Faloutsos/Pavlo 15-415/615 36 Faloutsos/Pavlo 15-415/615 37 MVCC Example #1 TS()=1 TS()=2 Object Value R-TS W-TS A 0 123 10 0 - - MVCC Example #1 TS()=1 TS()=2 Object Value R-TS W-TS A 0 123 10 0 A- 1-456 1-1 - - Faloutsos/Pavlo 15-415/615 37 Faloutsos/Pavlo 15-415/615 37

MVCC Example #1 TS()=1 TS()=2 Object Value R-TS W-TS A 0 123 10 0 A- 1-456 12-1 - - MVCC Example #1 TS()=1 TS()=2 Object Value R-TS W-TS A 0 123 10 0 A- 1-456 12-1 - - - 789 2-2 - A 2 Faloutsos/Pavlo 15-415/615 37 Faloutsos/Pavlo 15-415/615 37 MVCC Example #1 TS()=1 TS()=2 reads version A 1 that it wrote earlier. Object Value R-TS W-TS A 0 123 10 0 A- 1-456 12-1 - - - 789 2-2 - A 2 MVCC Example #2 Object Value R-TS W-TS A 0 123 10 0 Faloutsos/Pavlo 15-415/615 37 Faloutsos/Pavlo 15-415/615 38

MVCC Example #2 Object Value R-TS W-TS A 0 123 12 0 0 MVCC Example #2 Object Value R-TS W-TS A 0 123 12 0 0 Violation: TS() < R-TS(A 0 ) is aborted because moved time forward. Faloutsos/Pavlo 15-415/615 38 Faloutsos/Pavlo 15-415/615 38 MVCC MVCC Implementations Can still incur cascading aborts because a txn sees uncommitted versions from txns that started before it did. Old versions of tuples accumulate. The DBMS needs a way to remove old versions to reclaim storage space. Store versions directly in main tables: Postgres, Firebird/Interbase Store versions in separate temp tables: MSFT SQL Server Only store a single master version: Oracle, MySQL Faloutsos/Pavlo 15-415/615 39 Faloutsos/Pavlo 15-415/615 40

Garbage Collection Postgres Garbage Collection MySQL Never overwrites older versions. New tuples are appended to table. Deleted tuples are marked with a tombstone and then left in place. Separate background threads (VACUUM) has to scan tables to find tuples to remove. Only one master version for each tuple. Information about older versions are put in temp rollback segment and then pruned over time with a single thread (PURGE). Deleted tuples are left in place and the space is reused. Faloutsos/Pavlo 15-415/615 41 Faloutsos/Pavlo 15-415/615 42 MVCC Performance Issues Today's Class High abort overhead cost. Garbage collection overhead. Requires stalls to ensure recoverability. Secondary index updates. Basic Timestamp Ordering Optimistic Concurrency Control Multi-Version Concurrency Control The Phantom Problem Weaker Isolation Levels Faloutsos/Pavlo 15-415/615 43 Faloutsos/Pavlo 15-415/615 44

Dynamic s Recall that so far we have only dealing with transactions that read and update data. But now if we have insertions, updates, and deletions, we have new problems The Phantom Problem SELECT MAX(age) FROM sailors WHERE rating=1 SELECT MAX(age) FROM sailors WHERE rating=1 72 INSERT INTO sailors (age=96, rating=1) 96 Faloutsos/Pavlo 15-415/615 45 Faloutsos/Pavlo 15-415/615 46 The Phantom Problem SELECT MAX(age) FROM sailors WHERE rating=1 SELECT MAX(age) FROM sailors WHERE rating=1 72 INSERT INTO sailors (age=96, rating=1) 96 How did this happen? Because locked only existing records and not ones under way! Conflict serializability on reads and writes of individual items guarantees serializability only if the set of objects is fixed. Solution? Faloutsos/Pavlo 15-415/615 46 Faloutsos/Pavlo 15-415/615 47

Predicate Locking Index Locking Lock records that satisfy a logical predicate: Example: rating=1. In general, predicate locking has a lot of locking overhead. Index locking is a special case of predicate locking that is potentially more efficient. If there is a dense index on the rating field then the txn can lock index page containing the data with rating=1. If there are no records with rating=1, the txn must lock the index page where such a data entry would be, if it existed. Faloutsos/Pavlo 15-415/615 48 Faloutsos/Pavlo 15-415/615 49 Locking without an Index Today's Class If there is no suitable index, then the txn must obtain: A lock on every page in the table to prevent a record s rating from being changed to 1. The lock for the table itself to prevent records with rating=1 from being added or deleted. Basic Timestamp Ordering Optimistic Concurrency Control Multi-Version Concurrency Control The Phantom Problem Weaker Isolation Levels Faloutsos/Pavlo 15-415/615 50 Faloutsos/Pavlo 15-415/615 51

Weaker Levels of Isolation Isolation Levels Serializability is useful because it allows programmers to ignore concurrency issues. But enforcing it may allow too little concurrency and limit performance. We may want to use a weaker level of consistency to improve scalability. Controls the extent that a txn is exposed to the actions of other concurrent txns. Provides for greater concurrency at the cost of exposing txns to uncommitted changes: Dirty Reads Unrepeatable Reads Phantom Reads Faloutsos/Pavlo 15-415/615 52 Faloutsos/Pavlo 15-415/615 53 Isolation Levels Isolation Levels Isolation (High Low) SERIALIZABLE: No phantoms, all reads repeatable, no dirty reads. REPEATABLE S: Phantoms may happen. TED: Phantoms and unrepeatable reads may happen. UNTED: All of them may happen. Dirty Read Unrepeatable Read Phantom SERIALIZABLE No No No REPEATABLE No No Maybe TED No Maybe Maybe UNTED Maybe Maybe Maybe Faloutsos/Pavlo 15-415/615 54 Faloutsos/Pavlo 15-415/615 55

Isolation Levels SQL-92 Isolation Levels SERIALIZABLE: Obtain all locks first; plus index locks, plus strict 2PL. REPEATABLE S: Same as above, but no index locks. TED: Same as above, but S locks are released immediately. UNTED: Same as above, but allows dirty reads (no S locks). SET TRANSACTION ISOLATION LEVEL <isolation-level>; Not all DBMS support all isolation levels in all execution scenarios (e.g., replication). Default: Depends Faloutsos/Pavlo 15-415/615 56 Faloutsos/Pavlo 15-415/615 57 Isolation Levels Access Modes Default Maximum Actian Ingres 10.0/10S SERIALIZABLE SERIALIZABLE Aerospike TED TED Greenplum 4.1 TED SERIALIZABLE MySQL 5.6 REPEATABLE S SERIALIZABLE MemSQL 1b TED TED MS SQL Server 2012 TED SERIALIZABLE Oracle 11g TED SNAPSHOT ISOLATION Postgres 9.2.2 TED SERIALIZABLE SAP HANA TED SERIALIZABLE ScaleDB 1.02 TED TED VoltDB SERIALIZABLE SERIALIZABLE You can also provide hints to the DBMS about whether a txn will modify the database. Only two possible modes: ONLY Source: Peter Bailis, When is ACID ACID? Rarely. January 2013 Faloutsos/Pavlo 15-415/615 58 Faloutsos/Pavlo 15-415/615 59

SQL-92 SQL-92 Access Modes SET TRANSACTION <access-mode>; Postgres + MySQL 5.6 START TRANSACTION <access-mode>; Default: Not all DBMSs will optimize execution if you set a txn to in ONLY mode. Which CC Scheme is Best? Like many things in life, it depends How skewed is the workload? Are the txns short or long? Is the workload mostly read-only? Faloutsos/Pavlo 15-415/615 60 Faloutsos/Pavlo 15-415/615 61 Real Systems Summary Scheme Released Ingres Strict 2PL 1975 Informix Strict 2PL 1980 IBM DB2 Strict 2PL 1983 Oracle MVCC 1984 * Postgres MVCC 1985 MS SQL Server Strict 2PL or MVCC 1992 * MySQL (InnoDB) MVCC+2PL 2001 Aerospike OCC 2009 SAP HANA MVCC 2010 VoltDB Partition T/O 2010 MemSQL MVCC 2011 MS Hekaton MVCC+OCC 2013 Faloutsos/Pavlo 15-415/615 62 Concurrency control is hard. Faloutsos/Pavlo 15-415/615 63