The need for Temporal Databases (1)Need for coping with temporal data (both VT and TT) (2)Just adding 1 (or 2, or 4) temporal attributes (and maybe some.

Slides:



Advertisements
Similar presentations
Fourth normal form: 4NF 1. 2 Normal forms desirable forms for relations in DB design eliminate redundancies avoid update anomalies enforce integrity constraints.
Advertisements

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
From Handbook of Temporal Reasoning in Artificial Intelligence By Jan Chomicki & David Toman Temporal Databases Presented by Leila Jalali CS224 presentation.
Query Optimization Reserves Sailors sid=sid bid=100 rating > 5 sname (Simple Nested Loops) Imperative query execution plan: SELECT S.sname FROM Reserves.
Relational Algebra, Join and QBE Yong Choi School of Business CSUB, Bakersfield.
D ATABASE S YSTEMS I R ELATIONAL A LGEBRA. 22 R ELATIONAL Q UERY L ANGUAGES Query languages (QL): Allow manipulation and retrieval of data from a database.
BCDM Temporal Domains - Time is linear and totally ordered - Chronons are the basic time unit - Time domains are isomorphic to subsets of the domain of.
Chapter 5 Types. 5-2 Topics in this Chapter Values vs. Variables Types vs. Representations Type Definition Operators Type Generators SQL Facilities.
Relational Algebra 1 Chapter 5.1 V3.0 Napier University Dr Gordon Russell.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 5 More SQL: Complex Queries, Triggers, Views, and Schema Modification.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 52 Database Systems I Relational Algebra.
Midterm Review Lecture 14b. 14 Lectures So Far 1.Introduction 2.The Relational Model 3.Disks and Files 4.Relational Algebra 5.File Org, Indexes 6.Relational.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Relational Algebra Chapter 4, Part A.
Database Systems More SQL Database Design -- More SQL1.
Relational Algebra Chapter 4 - part I. 2 Relational Query Languages  Query languages: Allow manipulation and retrieval of data from a database.  Relational.
The Relational Model Codd (1970): based on set theory Relational model: represents the database as a collection of relations (a table of values --> file)
Applying formal methods to clinical guidelines: the case of temporal information Paolo Terenziani Dipartimento di Informatica, Univ. del Piemonte Orientale.
Relation Decomposition A, A, … A 12n Given a relation R with attributes Create two relations R1 and R2 with attributes B, B, … B 12m C, C, … C 12l Such.
Midterm 1 Concepts Relational Algebra (DB4) SQL Querying and updating (DB5) Constraints and Triggers (DB11) Unified Modeling Language (DB9) Relational.
Relational Model & Relational Algebra. 2 Relational Model u Terminology of relational model. u How tables are used to represent data. u Connection between.
Lecture 2 The Relational Model. Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical relations.
CSE314 Database Systems More SQL: Complex Queries, Triggers, Views, and Schema Modification Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
CS609 Introduction. Databases Current state? Future?
Chapter 2 Adapted from Silberschatz, et al. CHECK SLIDE 16.
Ad Hoc Constraints Objectives of the Lecture : To consider Ad Hoc Constraints in principle; To consider Ad Hoc Constraints in SQL; To consider other aspects.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Relational Algebra.
FEN Introduction to the database field:  The Relational Model Seminar: Introduction to relational databases.
Unit III. Views A table that is derived from other tables Considered as a virtual table Does not store data.
Constraints, Triggers and Views COMSATS INSTITUTE OF INFORMATION TECHNOLOGY, VEHARI.
Chapter 10 Normalization Pearson Education © 2009.
IS 230Lecture 6Slide 1 Lecture 7 Advanced SQL Introduction to Database Systems IS 230 This is the instructor’s notes and student has to read the textbook.
1 Functional Dependencies and Normalization Chapter 15.
1 Lecture 7: Normal Forms, Relational Algebra Monday, 10/15/2001.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Database Management Systems Chapter 4 Relational Algebra.
Database Systems (Atzeni, Ceri, Paraboschi, Torlone) Chapter 3 : Relational algebra and calculus McGraw-Hill and Atzeni, Ceri, Paraboschi, Torlone 1999.
Chapter 2 Introduction to Relational Model. Example of a Relation attributes (or columns) tuples (or rows) Introduction to Relational Model 2.
Chapter 2: Intro to Relational Model. 2.2 Example of a Relation attributes (or columns) tuples (or rows)
Design Process - Where are we?
1 CS 430 Database Theory Winter 2005 Lecture 4: Relational Model.
資工所 在職碩一 P 莊浚銘 Temporal Database Paper Reading Report.
CMPT 258 Database Systems Relational Algebra (Chapter 4)
CSC271 Database Systems Lecture # 7. Summary: Previous Lecture  Relational keys  Integrity constraints  Views.
1 Announcements Reading for next week: Chapter 4 Your first homework will be assigned as soon as your database accounts have been set up.  Expect an .
CS240A: Databases and Knowledge Bases Temporal Applications and SQL Carlo Zaniolo Department of Computer Science University of California, Los Angeles.
Temporal Data Modeling
Query Processing – Implementing Set Operations and Joins Chap. 19.
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 5 Introduction to a First Course in Database Systems.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
LECTURE THREE RELATIONAL ALGEBRA 11. Objectives  Meaning of the term relational completeness.  How to form queries in relational algebra. 22Relational.
CS240A: Databases and Knowledge Bases Temporal Databases Carlo Zaniolo Department of Computer Science University of California, Los Angeles.
More SQL: Complex Queries, Triggers, Views, and Schema Modification
Ritu CHaturvedi Some figures are adapted from T. COnnolly
Module 2: Intro to Relational Model
Introduction to Relational Model
Chapter 2: Intro to Relational Model
Chapter 2: Intro to Relational Model
Chapter 2: Intro to Relational Model
Fourth normal form: 4NF.
Relational Algebra : #I
The Relational Model Textbook /7/2018.
The Relational Algebra
Chapter 2: Intro to Relational Model
Chapter 2: Intro to Relational Model
Example of a Relation attributes (or columns) tuples (or rows)
Chapter 2: Intro to Relational Model
Chapter 19 (part 1) Functional Dependencies
Chapter 2: Intro to Relational Model
Unit Relational Algebra 1
CS240A: Databases and Knowledge Bases A Taxonomy of Temporal DBs
Presentation transcript:

The need for Temporal Databases (1)Need for coping with temporal data (both VT and TT) (2)Just adding 1 (or 2, or 4) temporal attributes (and maybe some ad-hoc procedures) does not work! (3)First, a rigorous semantic framework is needed, to give formal specification to the implementation. Properties: clearness, expressiveness, upward compatibiliy. Ex. BCDM (4)Second, the implementation must be proven to respect the semantics. Core issue here: efficient (1-NF) implementations hardly grant uniqueness of representation. Ex TSQL2

Ad-hoc approaches are complex and are not likely to work Example 1. Projection (and temporal coalescing) NameSalaryTitleVT_startVT_end Andrea60000Ass. Provost1/1/199330/5/1993 Andrea70000Ass. Provost1/6/199330/9/1993 Andrea70000Provost1/10/199331/1/1994 Andrea70000Professor1/2/199431/12/1994 Question: salary history of Andrea “Intuitive” SQL query: SELECT Salary,VT_start,VT_end FROM Employee WHERE Name=“Andrea”

Ad-hoc approaches are complex and are not likely to work Result obtained: SalaryVT_startVT_end /1/199330/5/ /6/199330/9/ /10/199331/1/ /2/199431/12/1994 Desired result: SalaryVT_startVT_end /1/199330/5/ /6/199331/12/1994

Ad-hoc approaches are complex and are not likely to work How to get the desired result using SQL92: CREATE TABLE Temp(Salary, VT_start,VT_end) AS SELECT Salary, VT_start, VT_end FROM Employee WHERE Name = “Andrea”; Repeat UPDATE Temp T1 SET (T1.VT_end)=SELECT MAX(T2.VT_end) WHERE T1.Salary=T2.Salary AND T1.VT_start < T2.VT_Start AND T1.VT_end >= T2.VT_start AND T1.VT_end < T2.VT_end WHERE EXISTS (SELECT * FROM Temp AS T2 WHERE T1.Salary=T2.Salary AND T1.VT_start = T2.VT_start AND T1.VT_end < T2.VT_end) Until no tuples updated

Ad-hoc approaches are complex and are not likely to work How to get the desired result using SQL92 (continues!): DELETE FROM Temp T1 WHERE EXISTS(SELECT * FROM Temp AS T2 WHERE T1.Salary = T2.Salary AND ((T1.VT_start > T2.VT_Start) AND (T1.VT_end = T2.VT_Start) AND (T1.VT_end < T2.VT_end))

Ad-hoc approaches are complex and are not likely to work Underlying semantic phenomenon: Projection on temporal relations involves temporal coalescing about value equivalent tuples When it occurs (SQL): Whenever a proper subset of the attributes of the relations is chosen in the SELECT part of the query

Ad-hoc approaches are complex and are not likely to work How to get the desired result using a Temporal DB (ex. TSQL2) SELECT Salary FROM Employee WHERE Name = “Andrea”

Ad-hoc approaches are complex and are not likely to work Example 2. Join (and temporal intersection) NameSalaryVT_startVT_end Andrea600001/1/199330/5/1993 Andrea700001/6/199331/12/1994 Employee1 NameTitleVT_startVT_end AndreaAss. Provost1/1/199330/9/1993 AndreaProvost1/10/199331/1/1994 AndreaProfessor1/2/199431/12/1994 Employee2 Query: “combined” history of both Andrea’s salary and title

Ad-hoc approaches are complex and are not likely to work “Intuitive” SQL query: SELECT Salary, Title, Emp1.VT_start, Emp1.VT_end Emp2.VT_start, Emp2.VT_end FROM Employee1, Employee2 WHERE Employee1.Name=“Andrea” AND Employee1.Name=“Andrea”

Ad-hoc approaches are complex and are not likely to work Result obtained: SalaryEmp1. VT_start Emp1. VT_end TitleEmp2. VT_start Emp2. VT_end /1/199330/5/1993Ass. Provost1/1/199330/9/ /1/199330/5/1993Provost1/10/199331/1/ /1/199330/5/1993Professor1/2/199431/12/ /6/199331/12/1994Ass. Provost1/1/199330/9/ /6/199331/12/1994Provost1/10/199331/1/ /6/199331/12/1994Professor1/2/199431/12/1994

Ad-hoc approaches are complex and are not likely to work Result desired: SalaryTitleVT_startVT_end 60000Ass. Provost1/1/199330/5/ Ass. Provost1/6/199330/9/ Provost1/10/199331/1/ Professor1/2/199431/12/1994

Ad-hoc approaches are complex and are not likely to work How to get the desired result using SQL92: SELECT Employee1.Name,Salary,Dept,Employee1.VT_start,Employee1.VT_end FROM Employee1, Employee2 WHERE Employee1.Name=Employee2.Name AND Employee2.VT_start <= Employee1.VT_start AND Employee1.VT_end < Employee2.VT_end UNION SELECT Employee1.Name,Salary,Dept,Employee1.VT_start,Employee2.VT_end FROM Employee1, Employee2 WHERE Employee1.Name=Employee2.Name AND Employee1.VT_start >= Employee2.VT_start AND Employee2.VT_end < Employee1.VT_end AND Employye1.VT_start < Employee2.VT_end UNION SELECT Employee1.Name,Salary,Dept,Employee2.VT_start,Employee1.VT_end FROM Employee1, Employee2 WHERE Employee1.Name=Employee2.Name AND Employee2.VT_start > Employee2.VT_start AND Employee1.VT_end < Employee2.VT_end AND Employye2.VT_start < Employee1.VT_end UNION SELECT Employee1.Name,Salary,Dept,Employee2.VT_start,Employee2.VT_end FROM Employee1, Employee2 WHERE Employee1.Name=Employee2.Name AND Employee2.VT_start > Employee1.VT_start AND Employee2.VT_end < Employee1.VT_end

Ad-hoc approaches are complex and are not likely to work Underlying semantic phenomenon: Join (Cartesian product) on temporal relations involves temporal intersection When it occurs (SQL): Whenever more than one relation is used in the FROM part of the query Note: the number of terms in the SQL union is 2 n, where n is the number of relations in the FROM part

Ad-hoc approaches are complex and are not likely to work How to get the desired result using a Temporal DB (ex. TSQL2) SELECT Salary, Title FROM Employee1, Employee2 WHERE Employee1.Name=“Andrea” AND Employee1.Name=“Andrea”

Ad-hoc approaches are complex and are not likely to work And what about: - Union, difference, …, nested queries - Temporal predicates - Primary\secondary keys - Aggregate functions - Integrity constraints - Multiple (user-defined!) granularities - …… - arbitrary combinations of all the above issues Until now, just two simple examples concerning: - SELECT a subset of attributes (  loop to do colaescing) - FROM with >1 relations (exponential union to do intersection) ?

Ad-hoc approaches are complex and are not likely to work Key message: - Dealing with temporal data is a general problem in DB’s - Difficult problems (often “hidden” ones) have to be faced WHY? (informally) (1)Relational model assumes independence of attribute values Time attributes predicates about when the values of the other attributes hold in the modeled reality (VT) or are current in the DB (TT)

Ad-hoc approaches are complex and are not likely to work WHY? (informally) (2)Relational model assumes all data\knowledge is explicit The association of time to tuples involves “semantic assumptions” Such assumptions are part of our “commonsense” way of looking at time. However, they are NOT supported by the relational model (as long as they are left implicit) Making the semantic of time explicit is a complex task (everywhere, not only in DBs)

Ad-hoc approaches are complex and are not likely to work From a Software Engeneering point of view: Letting applications solve the problem in an ad-hoc way is: - Both cost and time expensive - Likely to lead to errors in the applications - Likely to make integration (shared data) between applications impossible

Ad-hoc approaches are complex and are not likely to work Temporal DB: an area of research aiming at providing once-and-forall principled and integrated solution to the problem