Temporal Databases: Data Models Kristian Torp Department of Computer Science Aalborg University people.cs.aau.dk/˜torp [email protected]November 2, 2015 daisy.aau.dk Kristian Torp (Aalborg University) Temporal Databases: Data Models November 2, 2015 1 / 50
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
The Ann rows are sequenced-duplicates in the interval [6, 12)
The Bart rows are not sequenced-duplicates
The Curt rows are value-equivalent in the period [6, 14)
Kristian Torp (Aalborg University) Temporal Databases: Data Models November 2, 2015 25 / 50
Quiz: Sequenced Duplicate
Example (Which Table contains Sequenced Duplicate Rows?)
Name Dept vts vte
Ann HR 2 8Ann RD 8 15Ann HR 5 now
Name Dept vts vte
Ann HR 2 6Ann RD 2 12Bart RD 12 now
Example (Which Table contains Sequenced Duplicate Rows?)
Name Dept vts vte
Ann HR 2 8Ann RD 8 15Ann AD 15 now
Name Dept vts vte
Ann HR 2 12Bart HR 2 12Ann HR 2 12
Kristian Torp (Aalborg University) Temporal Databases: Data Models November 2, 2015 26 / 50
Quiz: Sequenced Duplicate
Example (Which Table contains Sequenced Duplicate Rows?)
Name Dept vts vte
Ann HR 2 8Ann RD 8 15Ann HR 5 now
Name Dept vts vte
Ann HR 2 6Ann RD 2 12Bart RD 12 now
Example (Which Table contains Sequenced Duplicate Rows?)
Name Dept vts vte
Ann HR 2 8Ann RD 8 15Ann AD 15 now
Name Dept vts vte
Ann HR 2 12Bart HR 2 12Ann HR 2 12
Kristian Torp (Aalborg University) Temporal Databases: Data Models November 2, 2015 26 / 50
Current-Duplicate Rows
Definition (Current-Duplicate)Two rows r1 and r2 are value current-duplicate rows if their explicit columnsvalues are all equal in the current-time timeslice.
Example (Which Table contains Current-Duplicate Rows?)
Name Dept vts vte
Ann HR 2 8Ann RD 8 now
Ann HR 5 now
Name Dept vts vte
Ann HR 2 now
Ann HD 16 now
Bart RD 12 now
Example (Which Table contains Current-Duplicate Rows?)
Name Dept vts vte
Ann HR 2 8Ann RD 8 15Ann AD 15 now
Name Dept vts vte
Ann HR 2 12Bart HR 2 12Curt HR 2 12
Kristian Torp (Aalborg University) Temporal Databases: Data Models November 2, 2015 27 / 50
Current-Duplicate Rows
Definition (Current-Duplicate)Two rows r1 and r2 are value current-duplicate rows if their explicit columnsvalues are all equal in the current-time timeslice.
Example (Which Table contains Current-Duplicate Rows?)
Name Dept vts vte
Ann HR 2 8Ann RD 8 now
Ann HR 5 now
Name Dept vts vte
Ann HR 2 now
Ann HD 16 now
Bart RD 12 now
Example (Which Table contains Current-Duplicate Rows?)
Name Dept vts vte
Ann HR 2 8Ann RD 8 15Ann AD 15 now
Name Dept vts vte
Ann HR 2 12Bart HR 2 12Curt HR 2 12
Kristian Torp (Aalborg University) Temporal Databases: Data Models November 2, 2015 27 / 50
Current-Duplicate Rows
Definition (Current-Duplicate)Two rows r1 and r2 are value current-duplicate rows if their explicit columnsvalues are all equal in the current-time timeslice.
Example (Which Table contains Current-Duplicate Rows?)
Name Dept vts vte
Ann HR 2 8Ann RD 8 now
Ann HR 5 now
Name Dept vts vte
Ann HR 2 now
Ann HD 16 now
Bart RD 12 now
Example (Which Table contains Current-Duplicate Rows?)
Name Dept vts vte
Ann HR 2 8Ann RD 8 15Ann AD 15 now
Name Dept vts vte
Ann HR 2 12Bart HR 2 12Curt HR 2 12
Kristian Torp (Aalborg University) Temporal Databases: Data Models November 2, 2015 27 / 50
Non-Sequenced Duplicate
Definition (Non-Sequenced Duplicate)Two rows r1 and r2 are non-sequenced duplicates if all their columns(explicit and implicit) are identical.
NoteIf non-sequenced duplicates then also sequenced duplicates
It sequenced duplicates then also value equivalent
Kristian Torp (Aalborg University) Temporal Databases: Data Models November 2, 2015 30 / 50
Outline
1 State and Event Tables
2 State TablesValid Time
3 Uniqueness
4 Temporal KeysPrimary KeysForeign Keys
5 Summary
Kristian Torp (Aalborg University) Temporal Databases: Data Models November 2, 2015 31 / 50
Outline
1 State and Event Tables
2 State TablesValid Time
3 Uniqueness
4 Temporal KeysPrimary KeysForeign Keys
5 Summary
Kristian Torp (Aalborg University) Temporal Databases: Data Models November 2, 2015 32 / 50
Uniqueness over Time
CasesYour DNA profile remains constant over time
Your cell-phone number varies slowly over time, but always one
Your checking balances varies almost daily, but always one
The IBM stock value changes every second but always exactly onevalue
NoteThe notaion of a primary key caries over to temporal databases
The notaion of a foreign key caries over to temporal databases
Kristian Torp (Aalborg University) Temporal Databases: Data Models November 2, 2015 33 / 50
Primary Keys Informally
CasesYou have been working for a company for eight years. In this timeinterval you salary has changed several times. However, at any pointin time you have always had exactly one salary.
You have been married three times. However at any point in time youhave had either zero or one spouse.
Your car has driven 56,000 kilometers but for all millimeters driventhere has been exactly one driver.
You have a house that is 34 years old. Since the house was buildthere has at any time only been one owner of the house.
NoteThere is a general concept of time-varying uniqueness
Kristian Torp (Aalborg University) Temporal Databases: Data Models November 2, 2015 34 / 50
Kristian Torp (Aalborg University) Temporal Databases: Data Models November 2, 2015 36 / 50
Summary: Primary Key
Main PointsA temporal primary-key is a straight-forward extension of snapshotprimary keys
A temporal primary-key much more computation intesive
NoteLimited or no support for temporal primary keys in DBMSs
Kristian Torp (Aalborg University) Temporal Databases: Data Models November 2, 2015 37 / 50
Outline
1 State and Event Tables
2 State TablesValid Time
3 Uniqueness
4 Temporal KeysPrimary KeysForeign Keys
5 Summary
Kristian Torp (Aalborg University) Temporal Databases: Data Models November 2, 2015 38 / 50
Foreign Keys Informally
CasesYou cannot have a contract to rent a house in the period April toOctober if the house is first built in September
You cannot call your friend after the subscription of her/his cell-phonehas expired
You expect that the cinema has a copy of the movie Blade Runner IIavailable during the entire period where you have bought a ticket tosee this movie in the cinema
NoteThere is a constraint between the time interval associated with thephenomenon stored in the database.
Kristian Torp (Aalborg University) Temporal Databases: Data Models November 2, 2015 39 / 50
Temporal Foreign Key ExampleExample (emp and dept at time 19)