SlideShare a Scribd company logo
Temporal Databases: Modification
Kristian Torp
Department of Computer Science
Aalborg University
people.cs.aau.dk/˜torp
torp@cs.aau.dk
November 2, 2015
daisy.aau.dk
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 1 / 57
Outline
1 Transaction-Time State Tables
2 Valid-Time State Tables
Implicit Timestamping
Explicit Timestamping
3 Bitemporal State Tables
Implicit Timestamping
Explicit Timestaming
4 Summary
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 2 / 57
Learning Goals
Learning Goals
Understand modifications on transaction-time tables
Understand modifications on valid-time tables
Implicit timestamping, system supplied
Explicit timestamping, user supplied
Understand modifications on bitemporal tables
Implicit timestamping, system supplied
Explicit timestamping, user supplied
now and UC in modifications
Note
We will use integers for timestamps
simply because it takes up less space on slides
Will focus on state tables
Most expressive
Hardest to understand (compared to event)
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 3 / 57
Outline
1 Transaction-Time State Tables
2 Valid-Time State Tables
Implicit Timestamping
Explicit Timestamping
3 Bitemporal State Tables
Implicit Timestamping
Explicit Timestaming
4 Summary
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 4 / 57
Transaction-Time Example, Implicit Timestamping
Note
Implicit means timestamps values are always system supplied
Logical Operations
Time 4: Hire Ann to work in the HR department
Time 8: Move Ann to the RD department
Time 12: Hire Bart to work in the HR department
Time 16: Fire Bart
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 5 / 57
Transaction-Time Example, Implicit Timestamping
Note
Implicit means timestamps values are always system supplied
Logical Operations
Time 4: Hire Ann to work in the HR department
Time 8: Move Ann to the RD department
Time 12: Hire Bart to work in the HR department
Time 16: Fire Bart
Example (At Time 4: Transaction-Time Insert)
Name Dept tts tte
Ann HR 4 UC
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 5 / 57
Transaction-Time Example, Implicit Timestamping
Note
Implicit means timestamps values are always system supplied
Logical Operations
Time 4: Hire Ann to work in the HR department
Time 8: Move Ann to the RD department
Time 12: Hire Bart to work in the HR department
Time 16: Fire Bart
Example (At Time 8: Transaction-Time Update)
Name Dept tts tte
Ann HR 4 8
Ann RD 8 UC
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 5 / 57
Transaction-Time Example, Implicit Timestamping
Note
Implicit means timestamps values are always system supplied
Logical Operations
Time 4: Hire Ann to work in the HR department
Time 8: Move Ann to the RD department
Time 12: Hire Bart to work in the HR department
Time 16: Fire Bart
Example (At Time 12: Transaction-Time Insert)
Name Dept tts tte
Ann HR 4 8
Ann RD 8 UC
Bart HR 12 UC
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 5 / 57
Transaction-Time Example, Implicit Timestamping
Note
Implicit means timestamps values are always system supplied
Logical Operations
Time 4: Hire Ann to work in the HR department
Time 8: Move Ann to the RD department
Time 12: Hire Bart to work in the HR department
Time 16: Fire Bart
Example (At Time 16: Transaction-Time Delete)
Name Dept tts tte
Ann HR 4 8
Ann RD 8 UC
Bart HR 12 16
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 5 / 57
Transaction-Time Insert
Logical Operations
Time 4: Hire Ann to work in the HR department
Example (Emps as of Time 6)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Ann, HR
Example (Table)
Name Dept tts tte
Ann HR 4 UC
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 6 / 57
Transaction-Time Update
Logical Operations
Time 4: Hire Ann to work in the HR department
Time 8: Move Ann to the RD department
Example (Emps as of Time 10)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Ann, RD
Ann, HR
Example (Table)
Name Dept tts tte
Ann HR 4 8
Ann RD 8 UC
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 7 / 57
Transaction-Time Insert (Again)
Logical Operations
Time 4: Hire Ann to work in the HR department
Time 8: Move Ann to the RD department
Time 12: Hire Bart to work in the HR department
Example (Emps as of Time 14)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Bart, RD
Ann, RD
Ann, HR
Example (Table)
Name Dept tts tte
Ann HR 4 8
Ann RD 8 UC
Bart HR 12 UC
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 8 / 57
Transaction-Time Delete
Logical Operations
Time 4: Hire Ann to work in the HR department
Time 8: Move Ann to the RD department
Time 12: Hire Bart to work in the HR department
Time 16: Fire Bart
Example (Emps as of Time 18)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Bart, RD
Ann, RD
Ann, HR
Example (Table)
Name Dept tts tte
Ann HR 4 8
Ann RD 8 UC
Bart HR 12 16
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 9 / 57
Quiz: Transaction-Time State Table
Logical Operations
Time 4 Hire Curt to work in the HR department
Time 8 Move Curt to the RD department
Time 12 Fire Curt from the company
Name Dept tts tte
Curt HR 4 UC
Curt RD 8 UC
Name Dept tts tte
Curt HR 4 8
Curt RD 8 UC
A B
Name Dept tts tte
Curt HR 4 8
Curt RD 8 12
Name Dept tts tte
Curt HR 4 8
Curt RD 8 12
Curt RD 12 UC
C D
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 10 / 57
Summary: Transaction-Time Modifications
Main Points
Transaction time always system supplied values
Insert: Explicit attributes + [current time, UC)
Delete: Set column tte to current time
Update: A delete followed by an insert
Note
System always supplies the timestamps!!!
UC = Until Changed
Also called now or nobind-now
Queries on current state of table work as before
Backwards compatibility ⇒ no rewrite of existing code
Logical deletes (newer physical deletes)
More than one insert/update/delete per time unit
Physical database design split current from history
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 11 / 57
Outline
1 Transaction-Time State Tables
2 Valid-Time State Tables
Implicit Timestamping
Explicit Timestamping
3 Bitemporal State Tables
Implicit Timestamping
Explicit Timestaming
4 Summary
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 12 / 57
Outline
1 Transaction-Time State Tables
2 Valid-Time State Tables
Implicit Timestamping
Explicit Timestamping
3 Bitemporal State Tables
Implicit Timestamping
Explicit Timestaming
4 Summary
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 13 / 57
Valid-Time Implicit Timestamping
Note
Recall, implicit means timestamps values are always system supplied
Logical Operations
time: 4 Hire Ann to work in the HR department
time: 8 Move Ann to the RD department
time: 12 Hire Bart to work in the HR department
time: 16 Fire Bart
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 14 / 57
Valid-Time Implicit Timestamping
Note
Recall, implicit means timestamps values are always system supplied
Logical Operations
time: 4 Hire Ann to work in the HR department
time: 8 Move Ann to the RD department
time: 12 Hire Bart to work in the HR department
time: 16 Fire Bart
Example (At Time 4: Valid-Time Insert)
Name Dept vts vte
Ann HR 4 now
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 14 / 57
Valid-Time Implicit Timestamping
Note
Recall, implicit means timestamps values are always system supplied
Logical Operations
time: 4 Hire Ann to work in the HR department
time: 8 Move Ann to the RD department
time: 12 Hire Bart to work in the HR department
time: 16 Fire Bart
Example (At Time 8: Valid-Time Update)
Name Dept vts vte
Ann HR 4 8
Ann RD 8 now
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 14 / 57
Valid-Time Implicit Timestamping
Note
Recall, implicit means timestamps values are always system supplied
Logical Operations
time: 4 Hire Ann to work in the HR department
time: 8 Move Ann to the RD department
time: 12 Hire Bart to work in the HR department
time: 16 Fire Bart
Example (At Time 12: Valid-Time Insert)
Name Dept vts vte
Ann HR 4 8
Ann RD 8 now
Bart HR 12 now
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 14 / 57
Valid-Time Implicit Timestamping
Note
Recall, implicit means timestamps values are always system supplied
Logical Operations
time: 4 Hire Ann to work in the HR department
time: 8 Move Ann to the RD department
time: 12 Hire Bart to work in the HR department
time: 16 Fire Bart
Example (At Time 16: Valid-Time Delete)
Name Dept vts vte
Ann HR 4 8
Ann RD 8 now
Bart HR 12 16
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 14 / 57
Valid-Time Insert
Logical Operations
Time 4: Hire Ann to work in the HR department
Example (Emps as of Time 6)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Ann, HR
Example (Table)
Name Dept vts vte
Ann HR 4 now
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 15 / 57
Valid-Time Update
Logical Operations
Time 4: Hire Ann to work in the HR department
Time 8: Move Ann to the RD department
Example (Emps as of Time 10)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Ann, RD
Ann, HR
Example (Table)
Name Dept vts vte
Ann HR 4 8
Ann RD 4 now
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 16 / 57
Valid-Time Insert (Again)
Logical Operations
Time 4: Hire Ann to work in the HR department
Time 8: Move Ann to the RD department
Time 12: Hire Bart to work in the HR department
Example (Emps as of Time 14)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Bart, RD
Ann, RD
Ann, HR
Example (Table)
Name Dept vts vte
Ann HR 4 8
Ann RD 6 now
Bart HR 12 now
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 17 / 57
Valid-Time Delete
Logical Operations
Time 4: Hire Ann to work in the HR department
Time 8: Move Ann to the RD department
Time 12: Hire Bart to work in the HR department
Time 16: Fire Bart
Example (Emps as of Time 18)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Bart, RD
Ann, RD
Ann, HR
Example (Table)
Name Dept vts vte
Ann HR 4 8
Ann RD 6 now
Bart HR 12 16
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 18 / 57
Summary: Implicit Timestamping
Temporal Modifications
Insert: explicit attributes + [current time, now)
Delete: Set column vte to current time
Update: A delete followed by an insert
Note
Implicit valid-time and transaction-time is handled similarly
System can supplies the timestamps!!!
Operations on current state of table as before
Logical deletes (no physical deletes in these cases!!!)
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 19 / 57
Quiz: Modifications to Table
Logical Operations
time:1 Hire Curt to work in the HR department
time:12 Fire Curt
time:20 Hire Dan to work in the HR department
Name Dept vts vte
Curt HR 1 12
Dan HR 20 now
Name Dept vts vte
Curt HR 1 12
Curt HR 12 now
Dan HR 20 now
A B
Name Dept vts vte
Curt HR 1 now
Curt HR 12 now
Dan HR 20 now
Name Dept vts vte
Curt HR 1 12
Curt HR 12 20
Dan HR 20 now
C D
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 20 / 57
Quiz: Table to Modifications
Name Dept vts vte
Dan HR 1 now
Eli RD 10 20
A
Time 1 Hire Dan, HR
Time 10 Hire Eli, RD
B
Time 1 Hire Dan, HR
Time 10 Hire Eli, RD
Time 20 Fire Eli
C
Time 1 Hire Dan, HR
Time 10 Hire Eli, RD
Time 10 Fire Dan
Time 20 Fire Eli
D
Time 1 Hire Dan, HR
Time 10 Hire Eli, RD
Time 10 Eli to RD
Time 20 Fire Eli
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 21 / 57
Quiz: Conceptual Difference?
Example (Departments)
Name Dept vts vte
Ann HR 1 10
Ann RD 10 20
Ann HR 20 40
Name Dept vts vte
Ann HR 1 15
Ann RD 10 20
Ann HR 20 40
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 22 / 57
Quiz: Conceptual Difference?
Example (Departments)
Name Dept vts vte
Ann HR 1 10
Ann RD 10 20
Ann HR 20 40
Name Dept vts vte
Ann HR 1 15
Ann RD 10 20
Ann HR 20 40
Example (Salaries)
Name Salary vts vte
Ann 40 1 10
Ann 50 10 20
Ann 70 20 40
Name Salary vts vte
Ann 40 1 15
Ann 50 10 20
Ann 70 20 40
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 22 / 57
Outline
1 Transaction-Time State Tables
2 Valid-Time State Tables
Implicit Timestamping
Explicit Timestamping
3 Bitemporal State Tables
Implicit Timestamping
Explicit Timestaming
4 Summary
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 23 / 57
Valid-Time Example: Case One
Note
Exlicit means timestamps values are user supplied
Logical Operations
Time 4: Hire Ann HR department [2, 14)
Time 8: Hire Bart RD department [14, now)
Time 12: Fire Ann
Time 16: Move Bart to HR department
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 24 / 57
Valid-Time Example: Case One
Note
Exlicit means timestamps values are user supplied
Logical Operations
Time 4: Hire Ann HR department [2, 14)
Time 8: Hire Bart RD department [14, now)
Time 12: Fire Ann
Time 16: Move Bart to HR department
Example (At Time 4: Valid-Time Insert)
Name Dept vts vte
Ann HR 2 14
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 24 / 57
Valid-Time Example: Case One
Note
Exlicit means timestamps values are user supplied
Logical Operations
Time 4: Hire Ann HR department [2, 14)
Time 8: Hire Bart RD department [14, now)
Time 12: Fire Ann
Time 16: Move Bart to HR department
Example (At Time 8: Valid-Time Insert)
Name Dept vts vte
Ann HR 2 14
Bart RD 14 now
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 24 / 57
Valid-Time Example: Case One
Note
Exlicit means timestamps values are user supplied
Logical Operations
Time 4: Hire Ann HR department [2, 14)
Time 8: Hire Bart RD department [14, now)
Time 12: Fire Ann
Time 16: Move Bart to HR department
Example (At Time 12: Valid-Time Delete)
Name Dept vts vte
Ann HR 2 12
Bart RD 14 now
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 24 / 57
Valid-Time Example: Case One
Note
Exlicit means timestamps values are user supplied
Logical Operations
Time 4: Hire Ann HR department [2, 14)
Time 8: Hire Bart RD department [14, now)
Time 12: Fire Ann
Time 16: Move Bart to HR department
Example (At Time 16: Valid-Time Update)
Name Dept vts vte
Ann HR 2 12
Bart RD 14 16
Bart HR 16 now
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 24 / 57
Valid-Time Insert
Logical Operations
Time:4 Hire Ann HR department [2, 14)
Example (Emps at Time 6)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Ann, HR
Example (Table)
Name Dept vts vte
Ann HR 2 14
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 25 / 57
Valid-Time Insert with now
Logical Operations
Time 4: Hire Ann HR department [2, 14)
Time 8: Hire Bart RD department [14, now)
Example (Emps as of Time 10)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Bart, RD
Ann, HR
Example (Table)
Name Dept vts vte
Ann HR 2 14
Bart RD 14 now
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 26 / 57
Valid-Time Delete
Logical Operations
Time 4: Hire Ann HR department [2, 14)
Time 8: Hire Bart RD department [14, now)
Time 12: Fire Ann
Example (Emps as of Time 15)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Bart, RD
Ann, HR
Example (Table)
Name Dept vts vte
Ann HR 2 12
Bart RD 14 now
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 27 / 57
Valid-Time Update
Logical Operations
Time 4: Hire Ann HR department [2, 14)
Time 8: Hire Bart RD department [14, now)
Time 12: Fire Ann
Time 16: Move Bart to HR department
Example (Emps as of Time 18)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Bart, HR
Bart, RD
Ann, HR
Example (Table)
Name Dept vts vte
Ann HR 2 12
Bart RD 14 16
Bart HR 16 now
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 28 / 57
Valid-Time Example: Case Two
Logical Operations
Time 4: Hire Ann HR department [2, 18)
Time 8: Hire Bart RD Department [14, 24)
Time 12: Ann on leave [6, 14)
Time 16: Remove Bart from HR for the period [8, 20)
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 29 / 57
Valid-Time Example: Case Two
Logical Operations
Time 4: Hire Ann HR department [2, 18)
Time 8: Hire Bart RD Department [14, 24)
Time 12: Ann on leave [6, 14)
Time 16: Remove Bart from HR for the period [8, 20)
Example (At Time 4: Valid-Time Insert)
Name Dept vts vte
Ann HR 2 18
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 29 / 57
Valid-Time Example: Case Two
Logical Operations
Time 4: Hire Ann HR department [2, 18)
Time 8: Hire Bart RD Department [14, 24)
Time 12: Ann on leave [6, 14)
Time 16: Remove Bart from HR for the period [8, 20)
Example (At Time 8: Valid-Time Insert)
Name Dept vts vte
Ann HR 2 18
Bart RD 14 24
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 29 / 57
Valid-Time Example: Case Two
Logical Operations
Time 4: Hire Ann HR department [2, 18)
Time 8: Hire Bart RD Department [14, 24)
Time 12: Ann on leave [6, 14)
Time 16: Remove Bart from HR for the period [8, 20)
Example (At Time 12: Valid-Time Update)
Name Dept vts vte
Ann HR 2 6
Ann HR 14 18
Bart RD 14 24
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 29 / 57
Valid-Time Example: Case Two
Logical Operations
Time 4: Hire Ann HR department [2, 18)
Time 8: Hire Bart RD Department [14, 24)
Time 12: Ann on leave [6, 14)
Time 16: Remove Bart from HR for the period [8, 20)
Example (At Time 16: Valid-Time Delete)
Name Dept vts vte
Ann HR 2 6
Ann HR 14 18
Bart RD 20 24
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 29 / 57
Valid-Time Insert
Logical Operations
Time 4: Hire Ann HR department [2, 18)
Example (Emps as of Time 6)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Ann, HR
Example (Table)
Name Dept vts vte
Ann HR 2 18
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 30 / 57
Valid-Time Insert (Again)
Logical Operations
Time 4: Hire Ann HR department [2, 18)
Time 8: Hire Bart RD Department [14, 24)
Example (Emps as of Time 10)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Bart, RD
Ann, HR
Example (Table)
Name Dept vts vte
Ann HR 2 18
Bart RD 14 24
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 31 / 57
Valid-Time Update
Logical Operations
Time 4: Hire Ann HR department [2, 18)
Time 8: Hire Bart RD Department [14, 24)
Time 12: Ann on leave [6, 14)
Example (Emps as of Time 15)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Ann, HR
Bart, RD
Ann, HR
Example (Table)
Name Dept vts vte
Ann HR 2 6
Ann HR 14 16
Bart RD 14 24
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 32 / 57
Valid-Time Delete
Logical Operations
Time 4: Hire Ann HR department [2, 18)
Time 8: Hire Bart RD Department [14, 24)
Time 12: Ann on leave [6, 14)
Time 16: Remove Bart from HR for the period [8, 20)
Example (Emps as of Time 18)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
Ann, HR
Bart, RD
Ann, HR
Example (Table)
Name Dept vts vte
Ann HR 2 6
Ann HR 14 16
Bart RD 20 24
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 33 / 57
Visualizations of Delete
Example (Result: Zero Rows)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
Data
Delete
Result
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 34 / 57
Visualizations of Delete
Example (Result: Zero Rows)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
Data
Delete
Result
Example (Result: One Row)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
Data
Delete
Result
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 34 / 57
Visualizations of Delete
Example (Result: Zero Rows)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
Data
Delete
Result
Example (Result: One Row)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
Data
Delete
Result
Example (Result: Two Rows)
VT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
Data
Delete
Result Result
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 34 / 57
Valid-Time State Modifications, Explicit Timestamping
Operations
Insert: Explicit attributes + interval supplied
Delete: Remove where delete interval overlaps (for each original row)
0 rows if delete interval totally overlaps
1 row if delete interval left/right overlaps
2 rows if delete interval contained in row interval
Update: Delete followed by insert
Note
User supplies the timestamps
Physical deletes may occur
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 35 / 57
Outline
1 Transaction-Time State Tables
2 Valid-Time State Tables
Implicit Timestamping
Explicit Timestamping
3 Bitemporal State Tables
Implicit Timestamping
Explicit Timestaming
4 Summary
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 36 / 57
Outline
1 Transaction-Time State Tables
2 Valid-Time State Tables
Implicit Timestamping
Explicit Timestamping
3 Bitemporal State Tables
Implicit Timestamping
Explicit Timestaming
4 Summary
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 37 / 57
Bitemporal Example, Implicit Timestamping
Logical Operations
Time 4: Hire Ann to work in the HR department
Time 8: Move Ann to the RD department
Time 12: Hire Bart to work in the HR department
Time 16: Fire Bart
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 38 / 57
Bitemporal Example, Implicit Timestamping
Logical Operations
Time 4: Hire Ann to work in the HR department
Time 8: Move Ann to the RD department
Time 12: Hire Bart to work in the HR department
Time 16: Fire Bart
Example (At Time 4: Bitemporal Insert)
Name Dept vts vte tts tte
Ann HR 4 now 4 UC
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 38 / 57
Bitemporal Example, Implicit Timestamping
Logical Operations
Time 4: Hire Ann to work in the HR department
Time 8: Move Ann to the RD department
Time 12: Hire Bart to work in the HR department
Time 16: Fire Bart
Example (At Time 8: Bitemporal Update)
Name Dept vts vte tts tte
Ann HR 4 now 4 8
Ann HR 4 8 8 UC
Ann RD 8 now 8 UC
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 38 / 57
Bitemporal Example, Implicit Timestamping
Logical Operations
Time 4: Hire Ann to work in the HR department
Time 8: Move Ann to the RD department
Time 12: Hire Bart to work in the HR department
Time 16: Fire Bart
Example (At Time 12: : Bitemporal Insert)
Name Dept vts vte tts tte
Ann HR 4 now 4 8
Ann HR 4 8 8 UC
Ann RD 8 now 8 UC
Bart HR 12 now 12 UC
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 38 / 57
Bitemporal Example, Implicit Timestamping
Logical Operations
Time 4: Hire Ann to work in the HR department
Time 8: Move Ann to the RD department
Time 12: Hire Bart to work in the HR department
Time 16: Fire Bart
Example (At Time 16: : Bitemporal Delete)
Name Dept vts vte tts tte
Ann HR 4 now 4 8
Ann HR 4 8 8 UC
Ann RD 8 now 8 UC
Bart HR 12 now 12 16
Bart HR 12 16 16 UC
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 38 / 57
Bitemporal Graphs
Example (Ann)
TT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
VT
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Ann, HR Ann, HR
Ann, RD
Example (Bart)
TT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
VT
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Bart, HRBart, HR
Note
Visualized in two graphs, because data ”overlap”
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 39 / 57
Outline
1 Transaction-Time State Tables
2 Valid-Time State Tables
Implicit Timestamping
Explicit Timestamping
3 Bitemporal State Tables
Implicit Timestamping
Explicit Timestaming
4 Summary
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 40 / 57
Bitemporal Delete, Explicit Valid Time
Example (Case 1: No changes)
time:1 Insert Ann, HR, [2, 8)
Example (Case 2: Delete entire interval)
time:1 Insert Ann, HR, [2, 8)
time:5 Delete Ann, HR, [1, 10)
Example (Case 3: Delete first part)
time:1 Insert Ann, HR, [2, 8)
time:5 Delete Ann, HR, [1, 5)
Example (Case 4: Delete in the middle)
time:1 Insert Ann, HR, [2, 8)
time:5 Delete Ann, HR, [4, 7)
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 41 / 57
Bitemporal Delete, Explicit Valid Time, Case 1, Time 10
Example (Case 1: No changes)
time:1 Insert Ann, HR, [2, 8)
Example (Graph)
TT
0 1 2 3 4 5 6 7 8 9 10
VT
0
1
2
3
4
5
6
7
8
9
10
Ann, HR
Example (Table)
Name Dept vts vte tts tte
Ann HR 2 8 1 now
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 42 / 57
Bitemporal Delete, Explicit Valid Time, Case 2, Time 10
Example (Case 2: Delete entire interval)
time:1 Insert Ann, HR, [2, 8)
time:5 Delete Ann, HR, [1, 10)
Example (Graph)
TT
0 1 2 3 4 5 6 7 8 9 10
VT
0
1
2
3
4
5
6
7
8
9
10
Ann, HR
Example (Table)
Name Dept vts vte tts tte
Ann HR 2 8 1 5
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 43 / 57
Bitemporal Delete, Explicit Valid Time, Case 3, Time 10
Example (Case 3: Delete first part)
time:1 Insert Ann, HR, [2, 8)
time:5 Delete Ann, HR, [1, 5)
Example (Graph)
TT
0 1 2 3 4 5 6 7 8 9 10
VT
0
1
2
3
4
5
6
7
8
9
10
Ann, HR
Ann, HR
Example (Table)
Name Dept vts vte tts tte
Ann HR 2 8 1 5
Ann HR 5 8 5 UC
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 44 / 57
Bitemporal Delete, Explicit Valid Time, Case 4, Time 10
Example (Case 4: Delete in the middle)
time:1 Insert Ann, HR, [2, 8)
time:5 Delete Ann, HR, [4, 7)
Example (Graph)
TT
0 1 2 3 4 5 6 7 8 9 10
VT
0
1
2
3
4
5
6
7
8
9
10
Ann, HR
Ann, HR
Ann, HR
Example (Table)
Name Dept vts vte tts tte
Ann HR 2 8 1 5
Ann HR 2 4 5 UC
Ann HR 7 8 5 UC
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 45 / 57
Bitemporal Delete Explicit Valid-Time, Summary, Time 10
TT
0 1 2 3 4 5 6 7 8 9 10
VT
0
1
2
3
4
5
6
7
8
9
10
Ann, HR
TT
0 1 2 3 4 5 6 7 8 9 10
VT
0
1
2
3
4
5
6
7
8
9
10
Ann, HR
TT
0 1 2 3 4 5 6 7 8 9 10
VT
0
1
2
3
4
5
6
7
8
9
10
Ann, HR
Ann, HR
TT
0 1 2 3 4 5 6 7 8 9 10
VT
0
1
2
3
4
5
6
7
8
9
10
Ann, HR
Ann, HR
Ann, HR
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 46 / 57
Bitemporal Update Explicit Valid-Time
Example (Case 1: No changes)
time:1 Insert Ann, HR, [2, 8)
Example (Case 2: Update entire interval)
time:1 Insert Ann, HR, [2, 8)
time:5 Update Ann, RD, [1, 10)
Example (Case 3: Update first part)
time:1 Insert Ann, HR, [2, 8)
time:5 Update Ann, RD, [1, 5)
Example (Case 4: Update in the middle)
time:1 Insert Ann, HR, [2, 8)
time:5 Update Ann, RD, [4, 7)
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 47 / 57
Bitemporal Update Explicit Valid-Time, Case 1, Time 10
Example (Case 1: No changes)
time:1 Insert Ann, HR, [2, 8)
Example (Graph)
TT
0 1 2 3 4 5 6 7 8 9 10
VT
0
1
2
3
4
5
6
7
8
9
10
Ann, HR
Example (Table)
Name Dept vts vte tts tte
Ann HR 2 8 1 now
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 48 / 57
Bitemporal Update Explicit Valid-Time, Case 2, Time 10
Example (Case 2: Update entire)
time:1 Insert Ann, HR, [2, 8)
time:5 Update Ann, RD, [1, 10)
Example (Graph)
TT
0 1 2 3 4 5 6 7 8 9 10
VT
0
1
2
3
4
5
6
7
8
9
10
Ann, HRAnn, RD
Example (Table)
Name Dept vts vte tts tte
Ann HR 2 8 1 5
Ann RD 1 10 5 UC
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 49 / 57
Bitemporal Update Explicit Valid-Time, Case 3, Time 10
Example (Case 3: Update first part)
time:1 Insert Ann, HR, [2, 8)
time:5 Update Ann, RD, [1, 5)
Example (Graph)
TT
0 1 2 3 4 5 6 7 8 9 10
VT
0
1
2
3
4
5
6
7
8
9
10
Ann, HR
Ann, HR
Ann, RD
Example (Table)
Name Dept vts vte tts tte
Ann HR 2 8 1 5
Ann HR 5 8 5 UC
Ann RD 1 5 5 UC
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 50 / 57
Bitemporal Update Explicit Valid-Time, Case 4, Time 10
Example (Case 4: Update in the middle)
time:1 Insert Ann, HR, [2, 8)
time:5 Update Ann, RD, [4, 7)
Example (Graph)
TT
0 1 2 3 4 5 6 7 8 9 10
VT
0
1
2
3
4
5
6
7
8
9
10
Ann, HR
Ann, HR
Ann, HR
Ann, RD
Example (Table)
Name Dept vts vte tts tte
Ann HR 2 8 1 5
Ann HR 2 4 5 UC
Ann HR 7 8 5 UC
Ann RD 4 7 5 UC
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 51 / 57
Bitemporal Graphs: Explicit Valid-Time at Time 10
TT
0 1 2 3 4 5 6 7 8 9 10
VT
0
1
2
3
4
5
6
7
8
9
10
Ann, HR
TT
0 1 2 3 4 5 6 7 8 9 10
VT
0
1
2
3
4
5
6
7
8
9
10
Ann, HRAnn, RD
TT
0 1 2 3 4 5 6 7 8 9 10
VT
0
1
2
3
4
5
6
7
8
9
10
Ann, HR
Ann, HR
Ann, RD
TT
0 1 2 3 4 5 6 7 8 9 10
VT
0
1
2
3
4
5
6
7
8
9
10
Ann, HR
Ann, HR
Ann, HR
Ann, RD
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 52 / 57
Assignment: Bitemporal Modification I
Modifications on (Name, Salary)
Time:2 insert Joe, 10
Time:4 insert Tom, 22
Time:10 Update Joe’s salary to 15
Time:12 Delete Tom
Assignments
Show the content of the table emp bt at time 15
Draw the bitemporal graph for the table emp bt
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 53 / 57
Assignment: Bitemporal Modification II
Name Salary vts vte tts tte
Joe 10 2 now 2 10
Tom 22 4 now 4 12
Joe 10 2 10 10 UC
Joe 15 10 now 10 UC
Tom 22 4 12 4 UC
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 54 / 57
Assignment: Bitemporal Modification III
TT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
VT
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Joe, 10 Joe, 10
Joe, 15
TT
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
VT
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Tom, 22 Tom, 22
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 55 / 57
Outline
1 Transaction-Time State Tables
2 Valid-Time State Tables
Implicit Timestamping
Explicit Timestamping
3 Bitemporal State Tables
Implicit Timestamping
Explicit Timestaming
4 Summary
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 56 / 57
Summary
Main Points
Implicit timestamps valid-time ≈ transaction-time
Explicit timestamp for valid-time many details
Insert, fairly straight-forward
Delete, complicated because 0, 1, or 2 intervals
Update, is conceptual still a delete followed by an insert!
Many details for bitemporal with explicit timestamping
Again delete the hardest to understand
Update, is conceptual still a delete followed by an insert!
Note
Use half-open intervals, e.g., [10, 15) makes life simpler!
Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 57 / 57

More Related Content

More from torp42

The DE-9IM Matrix in Details using ST_Relate: In Picture and SQL
The DE-9IM Matrix in Details using ST_Relate: In Picture and SQLThe DE-9IM Matrix in Details using ST_Relate: In Picture and SQL
The DE-9IM Matrix in Details using ST_Relate: In Picture and SQL
torp42
 
Spatial Indexing
Spatial IndexingSpatial Indexing
Spatial Indexing
torp42
 
XML on SQL Server
XML on SQL ServerXML on SQL Server
XML on SQL Server
torp42
 
Entity-Relationship Diagrams ERD
Entity-Relationship Diagrams ERDEntity-Relationship Diagrams ERD
Entity-Relationship Diagrams ERD
torp42
 
Introduction to XPath
Introduction to XPathIntroduction to XPath
Introduction to XPath
torp42
 
Introduction to DTD
Introduction to DTDIntroduction to DTD
Introduction to DTD
torp42
 
Introduction to XML and Databases
Introduction to XML and DatabasesIntroduction to XML and Databases
Introduction to XML and Databases
torp42
 

More from torp42 (7)

The DE-9IM Matrix in Details using ST_Relate: In Picture and SQL
The DE-9IM Matrix in Details using ST_Relate: In Picture and SQLThe DE-9IM Matrix in Details using ST_Relate: In Picture and SQL
The DE-9IM Matrix in Details using ST_Relate: In Picture and SQL
 
Spatial Indexing
Spatial IndexingSpatial Indexing
Spatial Indexing
 
XML on SQL Server
XML on SQL ServerXML on SQL Server
XML on SQL Server
 
Entity-Relationship Diagrams ERD
Entity-Relationship Diagrams ERDEntity-Relationship Diagrams ERD
Entity-Relationship Diagrams ERD
 
Introduction to XPath
Introduction to XPathIntroduction to XPath
Introduction to XPath
 
Introduction to DTD
Introduction to DTDIntroduction to DTD
Introduction to DTD
 
Introduction to XML and Databases
Introduction to XML and DatabasesIntroduction to XML and Databases
Introduction to XML and Databases
 

Recently uploaded

Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 

Recently uploaded (20)

Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 

Temporal Databases: Modifications

  • 1. Temporal Databases: Modification Kristian Torp Department of Computer Science Aalborg University people.cs.aau.dk/˜torp torp@cs.aau.dk November 2, 2015 daisy.aau.dk Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 1 / 57
  • 2. Outline 1 Transaction-Time State Tables 2 Valid-Time State Tables Implicit Timestamping Explicit Timestamping 3 Bitemporal State Tables Implicit Timestamping Explicit Timestaming 4 Summary Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 2 / 57
  • 3. Learning Goals Learning Goals Understand modifications on transaction-time tables Understand modifications on valid-time tables Implicit timestamping, system supplied Explicit timestamping, user supplied Understand modifications on bitemporal tables Implicit timestamping, system supplied Explicit timestamping, user supplied now and UC in modifications Note We will use integers for timestamps simply because it takes up less space on slides Will focus on state tables Most expressive Hardest to understand (compared to event) Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 3 / 57
  • 4. Outline 1 Transaction-Time State Tables 2 Valid-Time State Tables Implicit Timestamping Explicit Timestamping 3 Bitemporal State Tables Implicit Timestamping Explicit Timestaming 4 Summary Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 4 / 57
  • 5. Transaction-Time Example, Implicit Timestamping Note Implicit means timestamps values are always system supplied Logical Operations Time 4: Hire Ann to work in the HR department Time 8: Move Ann to the RD department Time 12: Hire Bart to work in the HR department Time 16: Fire Bart Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 5 / 57
  • 6. Transaction-Time Example, Implicit Timestamping Note Implicit means timestamps values are always system supplied Logical Operations Time 4: Hire Ann to work in the HR department Time 8: Move Ann to the RD department Time 12: Hire Bart to work in the HR department Time 16: Fire Bart Example (At Time 4: Transaction-Time Insert) Name Dept tts tte Ann HR 4 UC Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 5 / 57
  • 7. Transaction-Time Example, Implicit Timestamping Note Implicit means timestamps values are always system supplied Logical Operations Time 4: Hire Ann to work in the HR department Time 8: Move Ann to the RD department Time 12: Hire Bart to work in the HR department Time 16: Fire Bart Example (At Time 8: Transaction-Time Update) Name Dept tts tte Ann HR 4 8 Ann RD 8 UC Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 5 / 57
  • 8. Transaction-Time Example, Implicit Timestamping Note Implicit means timestamps values are always system supplied Logical Operations Time 4: Hire Ann to work in the HR department Time 8: Move Ann to the RD department Time 12: Hire Bart to work in the HR department Time 16: Fire Bart Example (At Time 12: Transaction-Time Insert) Name Dept tts tte Ann HR 4 8 Ann RD 8 UC Bart HR 12 UC Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 5 / 57
  • 9. Transaction-Time Example, Implicit Timestamping Note Implicit means timestamps values are always system supplied Logical Operations Time 4: Hire Ann to work in the HR department Time 8: Move Ann to the RD department Time 12: Hire Bart to work in the HR department Time 16: Fire Bart Example (At Time 16: Transaction-Time Delete) Name Dept tts tte Ann HR 4 8 Ann RD 8 UC Bart HR 12 16 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 5 / 57
  • 10. Transaction-Time Insert Logical Operations Time 4: Hire Ann to work in the HR department Example (Emps as of Time 6) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Ann, HR Example (Table) Name Dept tts tte Ann HR 4 UC Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 6 / 57
  • 11. Transaction-Time Update Logical Operations Time 4: Hire Ann to work in the HR department Time 8: Move Ann to the RD department Example (Emps as of Time 10) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Ann, RD Ann, HR Example (Table) Name Dept tts tte Ann HR 4 8 Ann RD 8 UC Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 7 / 57
  • 12. Transaction-Time Insert (Again) Logical Operations Time 4: Hire Ann to work in the HR department Time 8: Move Ann to the RD department Time 12: Hire Bart to work in the HR department Example (Emps as of Time 14) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Bart, RD Ann, RD Ann, HR Example (Table) Name Dept tts tte Ann HR 4 8 Ann RD 8 UC Bart HR 12 UC Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 8 / 57
  • 13. Transaction-Time Delete Logical Operations Time 4: Hire Ann to work in the HR department Time 8: Move Ann to the RD department Time 12: Hire Bart to work in the HR department Time 16: Fire Bart Example (Emps as of Time 18) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Bart, RD Ann, RD Ann, HR Example (Table) Name Dept tts tte Ann HR 4 8 Ann RD 8 UC Bart HR 12 16 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 9 / 57
  • 14. Quiz: Transaction-Time State Table Logical Operations Time 4 Hire Curt to work in the HR department Time 8 Move Curt to the RD department Time 12 Fire Curt from the company Name Dept tts tte Curt HR 4 UC Curt RD 8 UC Name Dept tts tte Curt HR 4 8 Curt RD 8 UC A B Name Dept tts tte Curt HR 4 8 Curt RD 8 12 Name Dept tts tte Curt HR 4 8 Curt RD 8 12 Curt RD 12 UC C D Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 10 / 57
  • 15. Summary: Transaction-Time Modifications Main Points Transaction time always system supplied values Insert: Explicit attributes + [current time, UC) Delete: Set column tte to current time Update: A delete followed by an insert Note System always supplies the timestamps!!! UC = Until Changed Also called now or nobind-now Queries on current state of table work as before Backwards compatibility ⇒ no rewrite of existing code Logical deletes (newer physical deletes) More than one insert/update/delete per time unit Physical database design split current from history Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 11 / 57
  • 16. Outline 1 Transaction-Time State Tables 2 Valid-Time State Tables Implicit Timestamping Explicit Timestamping 3 Bitemporal State Tables Implicit Timestamping Explicit Timestaming 4 Summary Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 12 / 57
  • 17. Outline 1 Transaction-Time State Tables 2 Valid-Time State Tables Implicit Timestamping Explicit Timestamping 3 Bitemporal State Tables Implicit Timestamping Explicit Timestaming 4 Summary Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 13 / 57
  • 18. Valid-Time Implicit Timestamping Note Recall, implicit means timestamps values are always system supplied Logical Operations time: 4 Hire Ann to work in the HR department time: 8 Move Ann to the RD department time: 12 Hire Bart to work in the HR department time: 16 Fire Bart Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 14 / 57
  • 19. Valid-Time Implicit Timestamping Note Recall, implicit means timestamps values are always system supplied Logical Operations time: 4 Hire Ann to work in the HR department time: 8 Move Ann to the RD department time: 12 Hire Bart to work in the HR department time: 16 Fire Bart Example (At Time 4: Valid-Time Insert) Name Dept vts vte Ann HR 4 now Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 14 / 57
  • 20. Valid-Time Implicit Timestamping Note Recall, implicit means timestamps values are always system supplied Logical Operations time: 4 Hire Ann to work in the HR department time: 8 Move Ann to the RD department time: 12 Hire Bart to work in the HR department time: 16 Fire Bart Example (At Time 8: Valid-Time Update) Name Dept vts vte Ann HR 4 8 Ann RD 8 now Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 14 / 57
  • 21. Valid-Time Implicit Timestamping Note Recall, implicit means timestamps values are always system supplied Logical Operations time: 4 Hire Ann to work in the HR department time: 8 Move Ann to the RD department time: 12 Hire Bart to work in the HR department time: 16 Fire Bart Example (At Time 12: Valid-Time Insert) Name Dept vts vte Ann HR 4 8 Ann RD 8 now Bart HR 12 now Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 14 / 57
  • 22. Valid-Time Implicit Timestamping Note Recall, implicit means timestamps values are always system supplied Logical Operations time: 4 Hire Ann to work in the HR department time: 8 Move Ann to the RD department time: 12 Hire Bart to work in the HR department time: 16 Fire Bart Example (At Time 16: Valid-Time Delete) Name Dept vts vte Ann HR 4 8 Ann RD 8 now Bart HR 12 16 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 14 / 57
  • 23. Valid-Time Insert Logical Operations Time 4: Hire Ann to work in the HR department Example (Emps as of Time 6) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Ann, HR Example (Table) Name Dept vts vte Ann HR 4 now Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 15 / 57
  • 24. Valid-Time Update Logical Operations Time 4: Hire Ann to work in the HR department Time 8: Move Ann to the RD department Example (Emps as of Time 10) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Ann, RD Ann, HR Example (Table) Name Dept vts vte Ann HR 4 8 Ann RD 4 now Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 16 / 57
  • 25. Valid-Time Insert (Again) Logical Operations Time 4: Hire Ann to work in the HR department Time 8: Move Ann to the RD department Time 12: Hire Bart to work in the HR department Example (Emps as of Time 14) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Bart, RD Ann, RD Ann, HR Example (Table) Name Dept vts vte Ann HR 4 8 Ann RD 6 now Bart HR 12 now Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 17 / 57
  • 26. Valid-Time Delete Logical Operations Time 4: Hire Ann to work in the HR department Time 8: Move Ann to the RD department Time 12: Hire Bart to work in the HR department Time 16: Fire Bart Example (Emps as of Time 18) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Bart, RD Ann, RD Ann, HR Example (Table) Name Dept vts vte Ann HR 4 8 Ann RD 6 now Bart HR 12 16 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 18 / 57
  • 27. Summary: Implicit Timestamping Temporal Modifications Insert: explicit attributes + [current time, now) Delete: Set column vte to current time Update: A delete followed by an insert Note Implicit valid-time and transaction-time is handled similarly System can supplies the timestamps!!! Operations on current state of table as before Logical deletes (no physical deletes in these cases!!!) Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 19 / 57
  • 28. Quiz: Modifications to Table Logical Operations time:1 Hire Curt to work in the HR department time:12 Fire Curt time:20 Hire Dan to work in the HR department Name Dept vts vte Curt HR 1 12 Dan HR 20 now Name Dept vts vte Curt HR 1 12 Curt HR 12 now Dan HR 20 now A B Name Dept vts vte Curt HR 1 now Curt HR 12 now Dan HR 20 now Name Dept vts vte Curt HR 1 12 Curt HR 12 20 Dan HR 20 now C D Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 20 / 57
  • 29. Quiz: Table to Modifications Name Dept vts vte Dan HR 1 now Eli RD 10 20 A Time 1 Hire Dan, HR Time 10 Hire Eli, RD B Time 1 Hire Dan, HR Time 10 Hire Eli, RD Time 20 Fire Eli C Time 1 Hire Dan, HR Time 10 Hire Eli, RD Time 10 Fire Dan Time 20 Fire Eli D Time 1 Hire Dan, HR Time 10 Hire Eli, RD Time 10 Eli to RD Time 20 Fire Eli Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 21 / 57
  • 30. Quiz: Conceptual Difference? Example (Departments) Name Dept vts vte Ann HR 1 10 Ann RD 10 20 Ann HR 20 40 Name Dept vts vte Ann HR 1 15 Ann RD 10 20 Ann HR 20 40 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 22 / 57
  • 31. Quiz: Conceptual Difference? Example (Departments) Name Dept vts vte Ann HR 1 10 Ann RD 10 20 Ann HR 20 40 Name Dept vts vte Ann HR 1 15 Ann RD 10 20 Ann HR 20 40 Example (Salaries) Name Salary vts vte Ann 40 1 10 Ann 50 10 20 Ann 70 20 40 Name Salary vts vte Ann 40 1 15 Ann 50 10 20 Ann 70 20 40 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 22 / 57
  • 32. Outline 1 Transaction-Time State Tables 2 Valid-Time State Tables Implicit Timestamping Explicit Timestamping 3 Bitemporal State Tables Implicit Timestamping Explicit Timestaming 4 Summary Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 23 / 57
  • 33. Valid-Time Example: Case One Note Exlicit means timestamps values are user supplied Logical Operations Time 4: Hire Ann HR department [2, 14) Time 8: Hire Bart RD department [14, now) Time 12: Fire Ann Time 16: Move Bart to HR department Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 24 / 57
  • 34. Valid-Time Example: Case One Note Exlicit means timestamps values are user supplied Logical Operations Time 4: Hire Ann HR department [2, 14) Time 8: Hire Bart RD department [14, now) Time 12: Fire Ann Time 16: Move Bart to HR department Example (At Time 4: Valid-Time Insert) Name Dept vts vte Ann HR 2 14 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 24 / 57
  • 35. Valid-Time Example: Case One Note Exlicit means timestamps values are user supplied Logical Operations Time 4: Hire Ann HR department [2, 14) Time 8: Hire Bart RD department [14, now) Time 12: Fire Ann Time 16: Move Bart to HR department Example (At Time 8: Valid-Time Insert) Name Dept vts vte Ann HR 2 14 Bart RD 14 now Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 24 / 57
  • 36. Valid-Time Example: Case One Note Exlicit means timestamps values are user supplied Logical Operations Time 4: Hire Ann HR department [2, 14) Time 8: Hire Bart RD department [14, now) Time 12: Fire Ann Time 16: Move Bart to HR department Example (At Time 12: Valid-Time Delete) Name Dept vts vte Ann HR 2 12 Bart RD 14 now Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 24 / 57
  • 37. Valid-Time Example: Case One Note Exlicit means timestamps values are user supplied Logical Operations Time 4: Hire Ann HR department [2, 14) Time 8: Hire Bart RD department [14, now) Time 12: Fire Ann Time 16: Move Bart to HR department Example (At Time 16: Valid-Time Update) Name Dept vts vte Ann HR 2 12 Bart RD 14 16 Bart HR 16 now Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 24 / 57
  • 38. Valid-Time Insert Logical Operations Time:4 Hire Ann HR department [2, 14) Example (Emps at Time 6) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Ann, HR Example (Table) Name Dept vts vte Ann HR 2 14 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 25 / 57
  • 39. Valid-Time Insert with now Logical Operations Time 4: Hire Ann HR department [2, 14) Time 8: Hire Bart RD department [14, now) Example (Emps as of Time 10) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Bart, RD Ann, HR Example (Table) Name Dept vts vte Ann HR 2 14 Bart RD 14 now Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 26 / 57
  • 40. Valid-Time Delete Logical Operations Time 4: Hire Ann HR department [2, 14) Time 8: Hire Bart RD department [14, now) Time 12: Fire Ann Example (Emps as of Time 15) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Bart, RD Ann, HR Example (Table) Name Dept vts vte Ann HR 2 12 Bart RD 14 now Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 27 / 57
  • 41. Valid-Time Update Logical Operations Time 4: Hire Ann HR department [2, 14) Time 8: Hire Bart RD department [14, now) Time 12: Fire Ann Time 16: Move Bart to HR department Example (Emps as of Time 18) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Bart, HR Bart, RD Ann, HR Example (Table) Name Dept vts vte Ann HR 2 12 Bart RD 14 16 Bart HR 16 now Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 28 / 57
  • 42. Valid-Time Example: Case Two Logical Operations Time 4: Hire Ann HR department [2, 18) Time 8: Hire Bart RD Department [14, 24) Time 12: Ann on leave [6, 14) Time 16: Remove Bart from HR for the period [8, 20) Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 29 / 57
  • 43. Valid-Time Example: Case Two Logical Operations Time 4: Hire Ann HR department [2, 18) Time 8: Hire Bart RD Department [14, 24) Time 12: Ann on leave [6, 14) Time 16: Remove Bart from HR for the period [8, 20) Example (At Time 4: Valid-Time Insert) Name Dept vts vte Ann HR 2 18 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 29 / 57
  • 44. Valid-Time Example: Case Two Logical Operations Time 4: Hire Ann HR department [2, 18) Time 8: Hire Bart RD Department [14, 24) Time 12: Ann on leave [6, 14) Time 16: Remove Bart from HR for the period [8, 20) Example (At Time 8: Valid-Time Insert) Name Dept vts vte Ann HR 2 18 Bart RD 14 24 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 29 / 57
  • 45. Valid-Time Example: Case Two Logical Operations Time 4: Hire Ann HR department [2, 18) Time 8: Hire Bart RD Department [14, 24) Time 12: Ann on leave [6, 14) Time 16: Remove Bart from HR for the period [8, 20) Example (At Time 12: Valid-Time Update) Name Dept vts vte Ann HR 2 6 Ann HR 14 18 Bart RD 14 24 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 29 / 57
  • 46. Valid-Time Example: Case Two Logical Operations Time 4: Hire Ann HR department [2, 18) Time 8: Hire Bart RD Department [14, 24) Time 12: Ann on leave [6, 14) Time 16: Remove Bart from HR for the period [8, 20) Example (At Time 16: Valid-Time Delete) Name Dept vts vte Ann HR 2 6 Ann HR 14 18 Bart RD 20 24 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 29 / 57
  • 47. Valid-Time Insert Logical Operations Time 4: Hire Ann HR department [2, 18) Example (Emps as of Time 6) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Ann, HR Example (Table) Name Dept vts vte Ann HR 2 18 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 30 / 57
  • 48. Valid-Time Insert (Again) Logical Operations Time 4: Hire Ann HR department [2, 18) Time 8: Hire Bart RD Department [14, 24) Example (Emps as of Time 10) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Bart, RD Ann, HR Example (Table) Name Dept vts vte Ann HR 2 18 Bart RD 14 24 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 31 / 57
  • 49. Valid-Time Update Logical Operations Time 4: Hire Ann HR department [2, 18) Time 8: Hire Bart RD Department [14, 24) Time 12: Ann on leave [6, 14) Example (Emps as of Time 15) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Ann, HR Bart, RD Ann, HR Example (Table) Name Dept vts vte Ann HR 2 6 Ann HR 14 16 Bart RD 14 24 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 32 / 57
  • 50. Valid-Time Delete Logical Operations Time 4: Hire Ann HR department [2, 18) Time 8: Hire Bart RD Department [14, 24) Time 12: Ann on leave [6, 14) Time 16: Remove Bart from HR for the period [8, 20) Example (Emps as of Time 18) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Ann, HR Bart, RD Ann, HR Example (Table) Name Dept vts vte Ann HR 2 6 Ann HR 14 16 Bart RD 20 24 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 33 / 57
  • 51. Visualizations of Delete Example (Result: Zero Rows) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Data Delete Result Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 34 / 57
  • 52. Visualizations of Delete Example (Result: Zero Rows) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Data Delete Result Example (Result: One Row) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Data Delete Result Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 34 / 57
  • 53. Visualizations of Delete Example (Result: Zero Rows) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Data Delete Result Example (Result: One Row) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Data Delete Result Example (Result: Two Rows) VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 Data Delete Result Result Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 34 / 57
  • 54. Valid-Time State Modifications, Explicit Timestamping Operations Insert: Explicit attributes + interval supplied Delete: Remove where delete interval overlaps (for each original row) 0 rows if delete interval totally overlaps 1 row if delete interval left/right overlaps 2 rows if delete interval contained in row interval Update: Delete followed by insert Note User supplies the timestamps Physical deletes may occur Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 35 / 57
  • 55. Outline 1 Transaction-Time State Tables 2 Valid-Time State Tables Implicit Timestamping Explicit Timestamping 3 Bitemporal State Tables Implicit Timestamping Explicit Timestaming 4 Summary Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 36 / 57
  • 56. Outline 1 Transaction-Time State Tables 2 Valid-Time State Tables Implicit Timestamping Explicit Timestamping 3 Bitemporal State Tables Implicit Timestamping Explicit Timestaming 4 Summary Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 37 / 57
  • 57. Bitemporal Example, Implicit Timestamping Logical Operations Time 4: Hire Ann to work in the HR department Time 8: Move Ann to the RD department Time 12: Hire Bart to work in the HR department Time 16: Fire Bart Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 38 / 57
  • 58. Bitemporal Example, Implicit Timestamping Logical Operations Time 4: Hire Ann to work in the HR department Time 8: Move Ann to the RD department Time 12: Hire Bart to work in the HR department Time 16: Fire Bart Example (At Time 4: Bitemporal Insert) Name Dept vts vte tts tte Ann HR 4 now 4 UC Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 38 / 57
  • 59. Bitemporal Example, Implicit Timestamping Logical Operations Time 4: Hire Ann to work in the HR department Time 8: Move Ann to the RD department Time 12: Hire Bart to work in the HR department Time 16: Fire Bart Example (At Time 8: Bitemporal Update) Name Dept vts vte tts tte Ann HR 4 now 4 8 Ann HR 4 8 8 UC Ann RD 8 now 8 UC Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 38 / 57
  • 60. Bitemporal Example, Implicit Timestamping Logical Operations Time 4: Hire Ann to work in the HR department Time 8: Move Ann to the RD department Time 12: Hire Bart to work in the HR department Time 16: Fire Bart Example (At Time 12: : Bitemporal Insert) Name Dept vts vte tts tte Ann HR 4 now 4 8 Ann HR 4 8 8 UC Ann RD 8 now 8 UC Bart HR 12 now 12 UC Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 38 / 57
  • 61. Bitemporal Example, Implicit Timestamping Logical Operations Time 4: Hire Ann to work in the HR department Time 8: Move Ann to the RD department Time 12: Hire Bart to work in the HR department Time 16: Fire Bart Example (At Time 16: : Bitemporal Delete) Name Dept vts vte tts tte Ann HR 4 now 4 8 Ann HR 4 8 8 UC Ann RD 8 now 8 UC Bart HR 12 now 12 16 Bart HR 12 16 16 UC Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 38 / 57
  • 62. Bitemporal Graphs Example (Ann) TT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Ann, HR Ann, HR Ann, RD Example (Bart) TT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 Bart, HRBart, HR Note Visualized in two graphs, because data ”overlap” Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 39 / 57
  • 63. Outline 1 Transaction-Time State Tables 2 Valid-Time State Tables Implicit Timestamping Explicit Timestamping 3 Bitemporal State Tables Implicit Timestamping Explicit Timestaming 4 Summary Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 40 / 57
  • 64. Bitemporal Delete, Explicit Valid Time Example (Case 1: No changes) time:1 Insert Ann, HR, [2, 8) Example (Case 2: Delete entire interval) time:1 Insert Ann, HR, [2, 8) time:5 Delete Ann, HR, [1, 10) Example (Case 3: Delete first part) time:1 Insert Ann, HR, [2, 8) time:5 Delete Ann, HR, [1, 5) Example (Case 4: Delete in the middle) time:1 Insert Ann, HR, [2, 8) time:5 Delete Ann, HR, [4, 7) Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 41 / 57
  • 65. Bitemporal Delete, Explicit Valid Time, Case 1, Time 10 Example (Case 1: No changes) time:1 Insert Ann, HR, [2, 8) Example (Graph) TT 0 1 2 3 4 5 6 7 8 9 10 VT 0 1 2 3 4 5 6 7 8 9 10 Ann, HR Example (Table) Name Dept vts vte tts tte Ann HR 2 8 1 now Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 42 / 57
  • 66. Bitemporal Delete, Explicit Valid Time, Case 2, Time 10 Example (Case 2: Delete entire interval) time:1 Insert Ann, HR, [2, 8) time:5 Delete Ann, HR, [1, 10) Example (Graph) TT 0 1 2 3 4 5 6 7 8 9 10 VT 0 1 2 3 4 5 6 7 8 9 10 Ann, HR Example (Table) Name Dept vts vte tts tte Ann HR 2 8 1 5 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 43 / 57
  • 67. Bitemporal Delete, Explicit Valid Time, Case 3, Time 10 Example (Case 3: Delete first part) time:1 Insert Ann, HR, [2, 8) time:5 Delete Ann, HR, [1, 5) Example (Graph) TT 0 1 2 3 4 5 6 7 8 9 10 VT 0 1 2 3 4 5 6 7 8 9 10 Ann, HR Ann, HR Example (Table) Name Dept vts vte tts tte Ann HR 2 8 1 5 Ann HR 5 8 5 UC Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 44 / 57
  • 68. Bitemporal Delete, Explicit Valid Time, Case 4, Time 10 Example (Case 4: Delete in the middle) time:1 Insert Ann, HR, [2, 8) time:5 Delete Ann, HR, [4, 7) Example (Graph) TT 0 1 2 3 4 5 6 7 8 9 10 VT 0 1 2 3 4 5 6 7 8 9 10 Ann, HR Ann, HR Ann, HR Example (Table) Name Dept vts vte tts tte Ann HR 2 8 1 5 Ann HR 2 4 5 UC Ann HR 7 8 5 UC Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 45 / 57
  • 69. Bitemporal Delete Explicit Valid-Time, Summary, Time 10 TT 0 1 2 3 4 5 6 7 8 9 10 VT 0 1 2 3 4 5 6 7 8 9 10 Ann, HR TT 0 1 2 3 4 5 6 7 8 9 10 VT 0 1 2 3 4 5 6 7 8 9 10 Ann, HR TT 0 1 2 3 4 5 6 7 8 9 10 VT 0 1 2 3 4 5 6 7 8 9 10 Ann, HR Ann, HR TT 0 1 2 3 4 5 6 7 8 9 10 VT 0 1 2 3 4 5 6 7 8 9 10 Ann, HR Ann, HR Ann, HR Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 46 / 57
  • 70. Bitemporal Update Explicit Valid-Time Example (Case 1: No changes) time:1 Insert Ann, HR, [2, 8) Example (Case 2: Update entire interval) time:1 Insert Ann, HR, [2, 8) time:5 Update Ann, RD, [1, 10) Example (Case 3: Update first part) time:1 Insert Ann, HR, [2, 8) time:5 Update Ann, RD, [1, 5) Example (Case 4: Update in the middle) time:1 Insert Ann, HR, [2, 8) time:5 Update Ann, RD, [4, 7) Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 47 / 57
  • 71. Bitemporal Update Explicit Valid-Time, Case 1, Time 10 Example (Case 1: No changes) time:1 Insert Ann, HR, [2, 8) Example (Graph) TT 0 1 2 3 4 5 6 7 8 9 10 VT 0 1 2 3 4 5 6 7 8 9 10 Ann, HR Example (Table) Name Dept vts vte tts tte Ann HR 2 8 1 now Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 48 / 57
  • 72. Bitemporal Update Explicit Valid-Time, Case 2, Time 10 Example (Case 2: Update entire) time:1 Insert Ann, HR, [2, 8) time:5 Update Ann, RD, [1, 10) Example (Graph) TT 0 1 2 3 4 5 6 7 8 9 10 VT 0 1 2 3 4 5 6 7 8 9 10 Ann, HRAnn, RD Example (Table) Name Dept vts vte tts tte Ann HR 2 8 1 5 Ann RD 1 10 5 UC Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 49 / 57
  • 73. Bitemporal Update Explicit Valid-Time, Case 3, Time 10 Example (Case 3: Update first part) time:1 Insert Ann, HR, [2, 8) time:5 Update Ann, RD, [1, 5) Example (Graph) TT 0 1 2 3 4 5 6 7 8 9 10 VT 0 1 2 3 4 5 6 7 8 9 10 Ann, HR Ann, HR Ann, RD Example (Table) Name Dept vts vte tts tte Ann HR 2 8 1 5 Ann HR 5 8 5 UC Ann RD 1 5 5 UC Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 50 / 57
  • 74. Bitemporal Update Explicit Valid-Time, Case 4, Time 10 Example (Case 4: Update in the middle) time:1 Insert Ann, HR, [2, 8) time:5 Update Ann, RD, [4, 7) Example (Graph) TT 0 1 2 3 4 5 6 7 8 9 10 VT 0 1 2 3 4 5 6 7 8 9 10 Ann, HR Ann, HR Ann, HR Ann, RD Example (Table) Name Dept vts vte tts tte Ann HR 2 8 1 5 Ann HR 2 4 5 UC Ann HR 7 8 5 UC Ann RD 4 7 5 UC Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 51 / 57
  • 75. Bitemporal Graphs: Explicit Valid-Time at Time 10 TT 0 1 2 3 4 5 6 7 8 9 10 VT 0 1 2 3 4 5 6 7 8 9 10 Ann, HR TT 0 1 2 3 4 5 6 7 8 9 10 VT 0 1 2 3 4 5 6 7 8 9 10 Ann, HRAnn, RD TT 0 1 2 3 4 5 6 7 8 9 10 VT 0 1 2 3 4 5 6 7 8 9 10 Ann, HR Ann, HR Ann, RD TT 0 1 2 3 4 5 6 7 8 9 10 VT 0 1 2 3 4 5 6 7 8 9 10 Ann, HR Ann, HR Ann, HR Ann, RD Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 52 / 57
  • 76. Assignment: Bitemporal Modification I Modifications on (Name, Salary) Time:2 insert Joe, 10 Time:4 insert Tom, 22 Time:10 Update Joe’s salary to 15 Time:12 Delete Tom Assignments Show the content of the table emp bt at time 15 Draw the bitemporal graph for the table emp bt Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 53 / 57
  • 77. Assignment: Bitemporal Modification II Name Salary vts vte tts tte Joe 10 2 now 2 10 Tom 22 4 now 4 12 Joe 10 2 10 10 UC Joe 15 10 now 10 UC Tom 22 4 12 4 UC Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 54 / 57
  • 78. Assignment: Bitemporal Modification III TT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Joe, 10 Joe, 10 Joe, 15 TT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 VT 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Tom, 22 Tom, 22 Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 55 / 57
  • 79. Outline 1 Transaction-Time State Tables 2 Valid-Time State Tables Implicit Timestamping Explicit Timestamping 3 Bitemporal State Tables Implicit Timestamping Explicit Timestaming 4 Summary Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 56 / 57
  • 80. Summary Main Points Implicit timestamps valid-time ≈ transaction-time Explicit timestamp for valid-time many details Insert, fairly straight-forward Delete, complicated because 0, 1, or 2 intervals Update, is conceptual still a delete followed by an insert! Many details for bitemporal with explicit timestamping Again delete the hardest to understand Update, is conceptual still a delete followed by an insert! Note Use half-open intervals, e.g., [10, 15) makes life simpler! Kristian Torp (Aalborg University) Temporal Databases: Modification November 2, 2015 57 / 57