Quick Review of Apr 24 material Sorting (Sections 13.4) Sort-merge Algorithm for external sorting Join Operation implementations (sect. 13.5) –Size estimation.

Slides:



Advertisements
Similar presentations
Dr Alwyn Barry Dr Joanna Bryson
Advertisements

CM20145 Transactions & Serializability
1 Integrity Ioan Despi Transactions: transaction concept, transaction state implementation of atomicity and durability concurrent executions serializability,
Chapter 15: Transactions Transaction Concept Transaction Concept Concurrent Executions Concurrent Executions Serializability Serializability Testing for.
Principles of Transaction Management. Outline Transaction concepts & protocols Performance impact of concurrency control Performance tuning.
Transactions (Chapter ). What is it? Transaction - a logical unit of database processing Motivation - want consistent change of state in data Transactions.
Em Spatiotemporal Database Laboratory Pusan National University File Processing : Transaction Management 2004, Spring Pusan National University Ki-Joune.
Transaction Processing Lecture ACID 2 phase commit.
Chapter 7 Transactions 7.1 Transaction Concept 7.2 Transaction State 7.3 Implementation of Atomicity and Durability 7.4 Concurrent Executions 7.5 Serializability.
©Silberschatz, Korth and Sudarshan15.1Database System ConceptsTransactions Transaction Concept Transaction State Implementation of Atomicity and Durability.
Transaction Processing IS698 Min Song. 2 What is a Transaction?  When an event in the real world changes the state of the enterprise, a transaction is.
Chapter 8 : Transaction Management. u Function and importance of transactions. u Properties of transactions. u Concurrency Control – Meaning of serializability.
Database Management Systems I Alex Coman, Winter 2006
Query Optimization. General Overview Relational model - SQL  Formal & commercial query languages Functional Dependencies Normalization Physical Design.
©Silberschatz, Korth and Sudarshan15.1Database System Concepts Chapter 15: Transactions Transaction Concept Transaction State Implementation of Atomicity.
Transaction Management WXES 2103 Database. Content What is transaction Transaction properties Transaction management with SQL Transaction log DBMS Transaction.
Transaction. A transaction is an event which occurs on the database. Generally a transaction reads a value from the database or writes a value to the.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 14: Transactions.
Transactions Sylvia Huang CS 157B. Transaction A transaction is a unit of program execution that accesses and possibly updates various data items. A transaction.
TRANSACTIONS. Objectives Transaction Concept Transaction State Concurrent Executions Serializability Recoverability Implementation of Isolation Transaction.
Transaction Processing Concepts. 1. Introduction To transaction Processing 1.1 Single User VS Multi User Systems One criteria to classify Database is.
Transactions. Chapter 14: Transactions Transaction Concept Transaction State Concurrent Executions Serializability Recoverability Implementation of Isolation.
Lecture 7- Transactions Advanced Databases Masood Niazi Torshiz Islamic Azad University- Mashhad Branch
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan Chapter 15: Transactions.
Transaction Lectured by, Jesmin Akhter, Assistant professor, IIT, JU.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 15: Transactions.
1 Transactions. 2 Transaction Concept A transaction is a unit of program execution that accesses and possibly updates various data items. E.g. transaction.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 15: Transactions.
Chapter 15: Transactions
TRANSACTION MANAGEMENT R.SARAVANAKUAMR. S.NAVEEN..
Concurrency Control in Database Operating Systems.
©Silberschatz, Korth and Sudarshan15.1Database System Concepts Chapter 15: Transactions Transaction Concept Transaction State Implementation of Atomicity.
Database Techniek Lecture 4: Transactions (Chapter 13/15)
©Silberschatz, Korth and Sudarshan15.1Database System Concepts Chapter 15: Transactions Transaction Concept Transaction State Implementation of Atomicity.
Chapter 15: Transactions Loc Hoang CS 157B. Definition n A transaction is a discrete unit of work that must be completely processed or not processed at.
Computing & Information Sciences Kansas State University Wednesday, 05 Nov 2008CIS 560: Database System Concepts Lecture 28 of 42 Wednesday, 05 November.
Chapter 14 Transactions Yonsei University 1 st Semester, 2015 Sanghyun Park.
Chapter 10 Recovery System. ACID Properties  Atomicity. Either all operations of the transaction are properly reflected in the database or none are.
Chapter 15: Transactions Transaction Concept Transaction State Implementation of Atomicity and Durability Concurrent Executions Serializability Recoverability.
15.1 Transaction Concept A transaction is a unit of program execution that accesses and possibly updates various data items. E.g. transaction to transfer.
©Silberschatz, Korth and Sudarshan14.1Database System Concepts - 6 th Edition Chapter 14: Transactions Transaction Concept Transaction State Concurrent.
Advanced Database- Dr. Arasteh1 Advanced Database Bahman Arasteh ( Ph.D, Software Engineering ) Department of Software Engineering, Azad University of.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 14: Transactions.
Software System Lab. Transactions Transaction Concept A transaction is a unit of program execution that accesses and possibly updates various.
D ATABASE A DMINISTRATION L ECTURE N O 5 Muhammad Abrar.
10 1 Chapter 10 - A Transaction Management Database Systems: Design, Implementation, and Management, Rob and Coronel.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 14: Transactions.
DCL – Data Control Language
Chapter 15: Transactions
Chapter 14: Transactions
Database Management System
Part- A Transaction Management
Transactions.
ACID PROPERTIES.
Transactions Properties.
Transactions.
CS122B: Projects in Databases and Web Applications Winter 2018
Chapter 15: Transactions
Transactions Sylvia Huang CS 157B.
Chapter 14: Transactions
Module 15: Transactions.
Chapter 14: Transactions
Chapter 14: Transactions
UNIT -IV Transaction.
CS122B: Projects in Databases and Web Applications Winter 2019
CS122B: Projects in Databases and Web Applications Spring 2018
Transactions, Properties of Transactions
Presentation transcript:

Quick Review of Apr 24 material Sorting (Sections 13.4) Sort-merge Algorithm for external sorting Join Operation implementations (sect. 13.5) –Size estimation –Nested-loop method (and cost) –Sort-Merge Join (and cost) –Hash Join (and cost) –Indexed Join (and cost) –3-way Join

Remaining Material Read over sections the remainder of chapter 13 on your own (you are responsible for the material) We’re going to look at section 14.3 today (following slides) We’ve covered a significant part of the material in chapter 14 already, mixed in with the chapter 13 material in the class notes. Read through chapter 14 yourself; you are responsible for the material. We have five classes remaining (counting today) –the bulk of it will be spent on chapter 15 (15.1-5, 15.9) –additional material will be sections 16.1 (lock-based protocols) –and section 17.4 (log-based recovery) –if possible, we will attempt to finish up in time to use May 13 as a review –May 15? Optional Study Class?

Transformation of Relational Expressions (Section 14.3) Two relational algebra expressions are equivalent if they generate the same set of tuples on every legal database instance. –Important for optimization –Allows one relational expression to be replaced by another without affecting the results –We can choose among equivalent expressions according to which are lower cost (size or speed depending upon our needs) –An equivalence rule says that expression A is equivalent to B; we may replace A with B and vice versa in the optimizer.

Equivalence Rules (1) In the discussion that follows: E x represents a relational algebra expression  y represents a predicate L z represents a particular list of attributes  and  are selection and projection as usual cascade of selections: a conjunction of selections can be deconstructed into a series of them   1  2 (E) =   1 (   2 (E)) selections are commutative   1 (   2 (E)) =   2 (   1 (E))

Equivalence Rules (2) cascade of projections: only the final ops in a series of projections is necessary  L1 (  L2 (…(  L3 (E))…)) =  L1 (E) selections can be combined with Cartesian products and theta joins   (E 1 X E 2 ) = E 1 |X|  E 2   1 (E 1 | X|  2 E 2 ) = E 1 |X|  1  2 E 2 joins and theta-joins are commutative (if you ignore the order of attributes, which can be corrected by an appropriate projection) E 1 |X|  E 2 = E 2 |X|  E 1

Equivalence Rules (3) joins and cross product are associative (E 1 |X|  1  3 E 2 ) |X|  2 E 3 = E 1 |X|  1 (E 2 |X|  2  3 E 3 ) (where  2 involves attributes from only E 2 and E 3. ) (E 1 |X| E 2 ) |X| E 3 = E 1 |X| (E 2 |X| E 3 ) (E 1 X E 2 ) X E 3 = E 1 X (E 2 X E 3 ) (the above two equivalences are useful special cases of the first one)

Equivalence Rules (4) selection distributes over join in two cases: –if all the attributes in  1 appear only in one expression (say E 1 )   1 (E 1 |X|  E 2 ) = (   1 (E 1 )) |X|  E 2 –if all the attributes in  1 appear only in E 1 and all the attributes in  2 appear only in E 2   1   2 (E 1 |X|  E 2 ) = (   1 (E 1 )) |X|  (   2 ( E 2 )) (note that the first case is a special case of the second)

Equivalence Rules (5) projection distributes over join. Given L 1 and L 2 being attributes of E 1 and E 2 respectively: –if  involves attributes entirely from L 1 and L 2 then  L1  L2 (E 1 |X|  E 2 ) = (  L1 (E 1 )) |X|  (  L2 ( E 2 )) –if  involves attribute lists L3 and L4 (both not in L 1  L 2 ) from E 1 and E 2 respectively  L1  L2 (E 1 |X|  E 2 ) =  L1  L2 (  L1  L3 (E 1 )) |X|  (  L2  L4 ( E 2 ))

Equivalence Rules (6) union and intersection are commutative (difference is not) E 1  E 2 = E 2  E 1 E 1  E 2 = E 2  E 1 union and intersection are associative (difference is not) (E 1  E 2 )  E 3 = E 1  (E 2  E 3 ) (E 1  E 2 )  E 3 = E 1  (E 2  E 3 ) selection distributes over union, intersection, set difference   (E 1  E 2 ) =   (E 1 )    (E 2 )   (E 1  E 2 ) =   (E 1 )    (E 2 )   (E 1  E 2 ) =   (E 1 )  E 2   (E 1 - E 2 ) =   (E 1 ) -   (E 2 )   (E 1 - E 2 ) =   (E 1 ) - E 2

Chapter 15: Transactions A transaction is a single logical unit of database work -- for example, a transfer of funds from checking to savings account. It is a set of operations delimited by statements of the form begin transaction and end transaction To ensure database integrity, we require that transactions have the ACID properties –Atomic: all or nothing gets done. –Consistent: preserves the consistency of the database –Isolated: unaware of any other concurrent transactions (as if there were none) –Durable: after completion the results are permanent even through system crashes

ACID Transactions Transactions access data using two operations: –read (X) –write (X) ACID property violations: –Consistency is the responsibility of the programmer –System crash half-way through: atomicity issues –Another transaction modifies the data half-way through: isolation violation –example: transfer $50 from account A to account B T: read(A); A:=A-50; write (A); read (B); B:=B+50; write (B)

Transaction States Five possible states for a transaction: –active (executing) –partially committed (after last statement’s execution) –failed (can no longer proceed) –committed (successful completion) –aborted (after transaction has been rolled back

Transaction States Committed or Aborted transactions are called terminated Aborted transactions may be –restarted as a new transaction –killed if it is clear that it will fail again Rollbacks –can be requested by the transaction itself (go back to a given execution state) –some actions can’t be rolled back (e.g., a printed message, or an ATM cash withdrawal)

Concurrent Execution Transaction processing systems allow multiple transactions to run concurrently –improves throughput and resource utilization (I/O on transaction A can be done in parallel with CPU processing on transaction B) –reduced waiting time (short transactions need not wait for long ones operating on other parts of the database) –however, this can cause problems with the “I” (Isolation) property of ACID

Serializability Scheduling transactions so that they are serializable (equivalent to some serial schedule of the same transctions) ensures database consistency (and the “I” property of ACID) serial schedule is equivalent to having the transactions execute one at a time non-serial or interleaved schedule permits concurrent execution

Serial Schedule To the right T1 and T2 are on a serial schedule: T2 begins after T1 finishes. No problems.

Interleaved Schedule This is an example of an interleaved concurrent schedule that raises a number of database consistency concerns.