Chapter 2 The Big Picture. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 2-2 Databases We are particularly interested in relational databases.

Slides:



Advertisements
Similar presentations
CSCI 4333 Database Design and Implementation Review for Midterm Exam I
Advertisements

IS698: Database Management Min Song IS NJIT. The Relational Data Model.
1 Constraints, Triggers and Active Databases Chapter 9.
ICOM 6005 – Database Management Systems Design Dr. Manuel Rodríguez-Martínez Electrical and Computer Engineering Department Lecture 16 – Intro. to Transactions.
Transaction Processing Lecture ACID 2 phase commit.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 The Basic (Flat) Relational Model.
Chapter 7 Triggers and Active Databases. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 7-2 Trigger Overview Element of the database schema.
Distributed DBMSPage © 1998 M. Tamer Özsu & Patrick Valduriez Outline Introduction Background Distributed DBMS Architecture Distributed Database.
Transaction Management and Concurrency Control
1 Transaction Management Overview Yanlei Diao UMass Amherst March 15, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
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.
1 Relational Model. 2 Relational Database: Definitions  Relational database: a set of relations  Relation: made up of 2 parts: – Instance : a table,
Chapter 13 An Overview of Transaction Processing.
Chapter 8 : Transaction Management. u Function and importance of transactions. u Properties of transactions. u Concurrency Control – Meaning of serializability.
1 A Closer Look Underlying Concepts of Databases and Transaction Processing.
1 ACID Properties of Transactions Chapter Transactions Many enterprises use databases to store information about their state –e.g., Balances of.
1 A Closer Look Chapter 2. 2 Underlying Concepts of Databases and Transaction Processing.
1 The Big Picture of Databases We are particularly interested in relational databases Data is stored in tables.
1 Recap Database: –collection of data central to some enterprise that is managed by a Database Management System –reflection of the current state of the.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
Transaction Management WXES 2103 Database. Content What is transaction Transaction properties Transaction management with SQL Transaction log DBMS Transaction.
COMP 5138 Relational Database Management Systems Semester 2, 2007 Lecture 8A Transaction Concept.
Transaction Management and Concurrency Control
Quick Review of Apr 24 material Sorting (Sections 13.4) Sort-merge Algorithm for external sorting Join Operation implementations (sect. 13.5) –Size estimation.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 157 Database Systems I SQL Constraints and Triggers.
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 Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Transaction Management Overview Chapter 16.
1 Chapter 18 ACID Properties of Transactions. 2 Transactions Many enterprises use databases to store information about their state –e.g., Balances of.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 1: Introduction.
Lecture 2 The Relational Model. Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical relations.
Chapter 3 The Relational Model Transparencies Last Updated: Pebruari 2011 By M. Arief
Introduction. 
Chapter 3 An Introduction to Relational Databases.
1 CSE 480: Database Systems Lecture 23: Transaction Processing and Database Recovery.
Page 1 Topic 4 Relational Databases CPS510 Database Systems Abdolreza Abhari School of Computer Science Ryerson University.
DBSQL 3-1 Copyright © Genetic Computer School 2009 Chapter 3 Relational Database Model.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 10 Transaction Management.
1 Chapter 2 The Big Picture. 2 Database Models Hierarchical Model. Network Model. Relational Model. Object/Relational Model. Object-Oriented Model. Semistructured.
CS 162 Discussion Section Week 9 11/11 – 11/15. Today’s Section ●Project discussion (5 min) ●Quiz (10 min) ●Lecture Review (20 min) ●Worksheet and Discussion.
+ Constraints and triggers: maintaining the ACID properties of transactions CSCI 2141 W2013 Slides from:
FALL 2004CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
Introduction to Database Systems1. 2 Basic Definitions Mini-world Some part of the real world about which data is stored in a database. Data Known facts.
ICS 321 Fall 2011 The Database Language SQL (iv) Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 10/26/20111Lipyeow.
CSE314 Database Systems Lecture 3 The Relational Data Model and Relational Database Constraints Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
Chapter 1 Overview of Databases and Transactions.
©Silberschatz, Korth and Sudarshan14.1Database System Concepts - 6 th Edition Chapter 14: Transactions Transaction Concept Transaction State Concurrent.
CM Name : p.rajesh Year/Semester : VI Semester Subject : Advanced database system Subject Code : CM-603 Topic : Advanced database concepts Duration.
Mr.Prasad Sawant, MIT Pune India Introduction to DBMS.
CSC 411/511: DBMS Design Dr. Nan WangCSC411_L12_JDBC_MySQL 1 Transations.
Software System Lab. Transactions Transaction Concept A transaction is a unit of program execution that accesses and possibly updates various.
1 Advanced Database Concepts Transaction Management and Concurrency Control.
Multidatabase Transaction Management COP5711. Multidatabase Transaction Management Outline Review - Transaction Processing Multidatabase Transaction Management.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
3 Database Systems: Design, Implementation, and Management CHAPTER 9 Transaction Management and Concurrency Control.
10 1 Chapter 10 - A Transaction Management Database Systems: Design, Implementation, and Management, Rob and Coronel.
ASET 1 Amity School of Engineering & Technology B. Tech. (CSE/IT), III Semester Database Management Systems Jitendra Rajpurohit.
ICOM 6005 – Database Management Systems Design Dr. Manuel Rodríguez-Martínez Electrical and Computer Engineering Department Lecture 16 – Intro. to Transactions.
1 Chapter 2 The Big Picture. 2 Database Models Hierarchical Model. Network Model. Relational Model. Object/Relational Model. Object-Oriented Model. Semistructured.
CSCI-235 Micro-Computers in Science Databases. Database Concepts Data is any unorganized text, graphics, sounds, or videos A database is a collection.
Chapter 3 An Introduction to Relational Databases.
Chapter 13 Managing Transactions and Concurrency Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
Databases We are particularly interested in relational databases
Chapter 1: Introduction
Transactions Properties.
Chapter 2 The Big Picture.
Chapter 10 Transaction Management and Concurrency Control
Outline Introduction Background Distributed DBMS Architecture
Presentation transcript:

Chapter 2 The Big Picture

Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 2-2 Databases We are particularly interested in relational databases Data is stored in tables.

Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 2-3 Table Set of rows (no duplicates) rowEach row describes a different entity columnEach column states a particular fact about each entity domain –Each column has an associated domain Domain of Status = {fresh, soph, junior, senior} IdNameAddressStatus 1111John123 Mainfresh 2222Mary321 Oaksoph 1234Bob444 Pinesoph 9999Joan777 Grandsenior

Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 2-4 Relation Mathematical entity corresponding to a table –row ~ tuple –column ~ attribute Values in a tuple are related to each other –John lives at 123 Main Relation R can be thought of as predicate R –R (x,y,z) is true iff tuple (x,y,z) is in R

Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 2-5 Operations Operations on relations are precisely defined –Take relation(s) as argument, produce new relation as result –Unary (e.g., delete certain rows) –Binary (e.g., union, Cartesian product) Corresponding operations defined on tables as well equivalenceUsing mathematical properties, equivalence can be decided query optimization: –Important for query optimization: ? op1(T1,op2(T2)) = op3(op2(T1),T2)

Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 2-6 Structured Query Language: SQL Language for manipulating tables DeclarativeDeclarative – Statement specifies what needs to be obtained, not how it is to be achieved (e.g., how to access data, the order of operations) Due to declarativity of SQL, DBMS determines evaluation strategy –This greatly simplifies application programs –But DBMS is not infallible: programmers should have an idea of strategies used by DBMS so they can design better tables, indices, statements, in such a way that DBMS can evaluate statements efficiently

Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 2-7 Structured Query Language (SQL) Language for constructing a new table from argument table(s). –FROM indicates source tables –WHERE indicates which rows to retain It acts as a filter –SELECT indicates which columns to extract from retained rows Projection The result is a table. SELECT FROM WHERE

Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 2-8 Example SELECT Name FROM Student WHERE Id > 4999 Id Name Address Status 1234 John 123 Main fresh 5522 Mary 77 Pine senior 9876 Bill 83 Oak junior Student Name Mary Bill Result

Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 2-9 Examples Student SELECT Id, Name FROM Student WHERE Status = ‘senior’ Student SELECT * FROM Student WHERE Status = ‘senior’ Student SELECT COUNT(*) FROM Student WHERE Status = ‘senior’ result is a table with one column and one row

Copyright © 2005 Pearson Addison-Wesley. All rights reserved More Complex Example Goal: table in which each row names a senior and gives a course taken and grade Combines information in two tables: –Student –Student: Id, Name, Address, Status –Transcript –Transcript: StudId, CrsCode, Semester, Grade SELECT Name, CrsCode, Grade StudentTranscript FROM Student, Transcript WHERE StudId = Id AND Status = ‘senior’

Copyright © 2005 Pearson Addison-Wesley. All rights reserved Join a1a2a3 A1xxy B17rst b1b T1T2 FROM T1, T2 yields: a1a2a3b1b2 A1xxy3.217 A1xxy4.817 B17rst3.217 B17rst4.817 WHERE a2 = b2 yields: B17rst3.217 B17rst4.817 SELECT a1, b1 yields result: B3.2 B4.8 T1T2 SELECT a1, b1 T1T2 FROM T1, T2 WHERE a2 = b2

Copyright © 2005 Pearson Addison-Wesley. All rights reserved Modifying Tables UPDATE Student SET Status = ‘soph’ WHERE Id = Student INSERT INTO Student (Id, Name, Address, Status) VALUES ( , ‘Bill’, ‘432 Pine’, ‘senior’) Student DELETE FROM Student WHERE Id =

Copyright © 2005 Pearson Addison-Wesley. All rights reserved Creating Tables Student CREATE TABLE Student ( Id INTEGER, Name CHAR(20), Address CHAR(50), Status CHAR(10), PRIMARY KEY (Id) ) Constraint Constraint: explained later

Copyright © 2005 Pearson Addison-Wesley. All rights reserved Transactions Many enterprises use databases to store information about their state –E.g., balances of all depositors The occurrence of a real-world event that changes the enterprise state requires the execution of a program that changes the database state in a corresponding way –E.g., balance must be updated when you deposit transactionA transaction is a program that accesses the database in response to real-world events

Copyright © 2005 Pearson Addison-Wesley. All rights reserved Transactions Transactions are not just ordinary programs Additional requirements are placed on transactions (and particularly their execution environment) that go beyond the requirements placed on ordinary programs. –Atomicity –Consistency –Isolation –Durability (explained next) ACID properties

Copyright © 2005 Pearson Addison-Wesley. All rights reserved Integrity Constraints Rules of the enterprise generally limit the occurrence of certain real-world events. –Student cannot register for a course if current number of registrants = maximum allowed Correspondingly, allowable database states are restricted. –cur_reg <= max_reg integrity constraintsThese limitations are expressed as integrity constraints, which are assertions that must be satisfied by the database state.

Copyright © 2005 Pearson Addison-Wesley. All rights reserved Consistency Transaction designer must ensure that IF the database is in a state that satisfies all integrity constraints when execution of a transaction is started THEN when the transaction completes: All integrity constraints are once again satisfied (constraints can be violated in intermediate states) New database state satisfies specifications of transaction

Copyright © 2005 Pearson Addison-Wesley. All rights reserved Atomicity A real-world event either happens or does not happen. –Student either registers or does not register. Similarly, the system must ensure that either the transaction runs to completion (commits) or, if it does not complete, it has no effect at all (aborts). –This is not true of ordinary programs. A hardware or software failure could leave files partially updated.

Copyright © 2005 Pearson Addison-Wesley. All rights reserved Durability The system must ensure that once a transaction commits its effect on the database state is not lost in spite of subsequent failures. –Not true of ordinary systems. For example, a media failure after a program terminates could cause the file system to be restored to a state that preceded the execution of the program.

Copyright © 2005 Pearson Addison-Wesley. All rights reserved Isolation Deals with the execution of multiple transactions concurrently. serialIf the initial database state is consistent and accurately reflects the real-world state, then the serial (one after another) execution of a set of consistent transactions preserves consistency. But serial execution is inadequate from a performance perspective.

Copyright © 2005 Pearson Addison-Wesley. All rights reserved Concurrent Transaction Execution

Copyright © 2005 Pearson Addison-Wesley. All rights reserved Isolation Concurrent (interleaved) execution of a set of transactions offers performance benefits, but might not be correct. Example: Two students execute the course registration transaction at about the same time (cur_reg is the number of current registrants) T 1 : read(cur_reg : 29) write(cur_reg : 30) T 2 : read(cur_reg : 29) write(cur_reg : 30) time  Result: Database state no longer corresponds to real-world state, integrity constraint violated.

Copyright © 2005 Pearson Addison-Wesley. All rights reserved Isolation The effect of concurrently executing a set of transactions must be the same as if they had executed serially in some order serializable –The execution is thus not serial, but serializable Serializable execution has better performance than serial, but performance might still be inadequate. Database systems offer several isolation levels with different performance characteristics (but some guarantee correctness only for certain kinds of transactions – not in general)

Copyright © 2005 Pearson Addison-Wesley. All rights reserved ACID Properties The transaction monitor is responsible for ensuring atomicity, durability, and (the requested level of) isolation. –Hence it provides the abstraction of failure-free, non-concurrent environment, greatly simplifying the task of the transaction designer. The transaction designer is responsible for ensuring the consistency of each transaction, but doesn’t need to worry about concurrency and system failures.