SlideShare a Scribd company logo
Temporal Database
Linh Chau
Software Engineer
November 8th, 2017
22
Agenda
▪ Introduction
▪ Bi-temporality
▪ Example
▪ Q&A
33
What is temporal database?
44
Traditional way
ID Name Price (x1000 VND)
1 Coconut Oil 650
2 Honey 220
3 Medical Oil 120
55
Traditional way
▪ Store only current state of data.
▪ Modify data will overlap the existing data.
66
Questions
▪ How to retrieve history data?
▪ What happen if you delete data by accident?
▪ What if I need to retrieve the data in the past, or insert a reserved data for
future use?
→ We need something like time period to attach to the data, this is temporal
data.
A temporal database is a database with built-in support for handling data
involving time.
77
Temporal database
▪ Time period is attached to the data (time varying data).
▪ Express when the data is valid or stored in the database.
▪ Divided into two approaches:
▪ Time period when the data is true in the real world (valid time).
▪ Time period when data is stored in database (transaction time).
88
Valid time approach
ID Name Price (x1000 VND)
1 Coconut Oil 650
2 Honey 220
3 Medical Oil 120
99
Valid time approach
ID Name Price Valid From Valid Till
2 Honey 250 01/01/2016 01/09/2017
2 Honey 220 01/09/2017 02/02/2020
2 Honey 300 03/03/2025 04/04/2050
2 Honey 500 06/09/3000 09/06/3005
1010
Valid time approach
▪ Records the time when a fact is true in the real world.
▪ Represents data in the past, current for future
▪ Enables queries that show the state of the fact at a given time.
1111
Transaction time approach
ID Name Price
Valid
From
Valid Till
Known
From
Known
Till
2 Honey 250 01/01/2016 01/09/2017 08/08/2017 31/12/9999
2 Honey 220 01/09/2017 02/02/2020 08/08/2017 31/12/9999
2 Honey 300 03/03/2025 04/04/2050 08/08/2017 31/12/9999
2 Honey 500 06/09/3000 09/06/3005 08/08/2017 08/11/2017
2 Honey 5000 06/09/3000 09/06/3005 08/11/2017 31/12/9999
1212
Transaction time approach
▪ Records the time period during which a database entry is accepted as
correct.
▪ Enables queries that show the state of the database at a given time.
▪ Only occur in the past or up to the current time.
▪ In a transaction time table, records are never deleted.
1313
Bi-temporality
1414
Bi-Temporality
07.01 13.02 27.05 25.07
10.01
15.02
07.06
19.06
Validity
Knowing
China
Switzerland
Japan
Vietnam
1515
Bi-Temporality
07.01 13.02 27.05 25.07
10.01
15.02
07.06
19.06
Validity
Knowing
China
Switzerland
Japan
Vietnam
1616
Bi-Temporality
▪ In bi-temporality, we take care both point of view the validity and point of
view of the change.
▪ Through them, we get the exact valid information of the system at specific
time.
▪ No physical delete of the row in database.
1717
Use cases
▪ You want to reprint of a customer’s invoices of July 2017.
▪ What was the profit last year?
▪ Where do you enter the new address of this customer since the first next
month?
▪ The client wants to book a reservation of your hotel next year.
1818
Application domains
▪ Financial apps: portfolio management, accounting, banking.
▪ Record-keeping: personal, medical, inventory management.
▪ Scheduling apps: airline, train, hotel reservation...
▪ CRM apps (customer history / future)
⇒ Time varying data has always been in business requirements.
1919
Example
2020
Insert
Insert record “A”, valid from 01.01.2016.
2121
Insert
Valid
Know
2222
Insert
sysdate
Valid
Know
01.01.2016
2323
Insert
sysdate
Valid
Know
01.01.2016
A
2424
Insert
Action Data Valid From Valid Till Known From Known Till
Insert A 01.01.2016 31.12.9999 sysdate 31.12.9999
▪ 01.01.2016: when the data is valid
▪ 31.12.9999: infinity
▪ sysdate: “now”
2525
Delete
“Remove” record “A”
2626
Delete
sysdate1
Valid
Know
01.01.2016
A
2727
Delete
sysdate1
Valid
Know
01.01.2016
A
sysdate2
2828
Delete
Action Data Valid From Valid Till Known From Known Till
Update A - - - sysdate
▪ “-”: no change
2929
Close
Update record “A”, set valid until 06.06.2016.
3030
Close
sysdate1
Valid
Know
01.01.2016
A
3131
Close
sysdate1
Valid
Know
01.01.2016
A
A
sysdate2
06.06.2016
3232
Close
Action Data Valid From Valid Till Known From Known Till
Update A - - - sysdate
Insert A 01.01.2016 06.06.2016 sysdate 31.12.9999
3333
Update future with infinity
Update record by value “B”, effect from 06.06.2016.
3434
Update future with infinity
sysdate1
Valid
Know
01.01.2016
A
3535
Update future with infinity
sysdate1
Valid
Know
01.01.2016
A
A
sysdate2
06.06.2016
B
3636
Update future with infinity
Action Data Valid From Valid Till Known From Known Till
Update A - - - sysdate
Insert A 01.01.2016 06.06.2016 sysdate 31.12.9999
Insert B 06.06.2016 31.12.9999 sysdate 31.12.9999
3737
Update the past with infinity
Update record by value “C”, effect from 03.03.2016.
3838
Update the past with infinity
sysdate1
Valid
Know
01.01.2016
A
A
sysdate2
06.06.2016
B
3939
Update the past with infinity
sysdate1
Valid
Know
01.01.2016
A
A
sysdate2
06.06.2016
B
sysdate3
C
03.03.2016
4040
Update the past with infinity
Action Data Valid From Valid Till Known From Known Till
Update A - - - sysdate
Update B - - - sysdate
Insert A 01.01.2016 03.03.2016 sysdate 31.12.9999
Insert C 03.03.2016 31.12.9999 sysdate 31.12.9999
4141
Update the past with close date after first update
Update record by value “C”, effect from 03.03.2016 to 09.09.2016.
4242
Update the past with close date after first update
sysdate1
Valid
Know
01.01.2016
A
A
sysdate2
06.06.2016
B
4343
Update the past with close date after first update
sysdate1
Valid
Know
01.01.2016
A
A
sysdate2
06.06.2016
B
sysdate3
C
03.03.2016 09.09.2016
B
4444
Update the past with close date after first update
Action Data Valid From Valid Till Known From Known Till
Update A - - - sysdate
Update B - - - sysdate
Insert C 03.03.2016 09.09.2016 sysdate 31.12.9999
Insert A 01.01.2016 03.03.2016 sysdate 31.12.9999
Insert B 09.09.2016 31.12.9999 sysdate 31.12.9999
4545
Update the past with close date before first update
Update record by value “C”, effect from 03.03.2016 to 04.04.2016
4646
Update the past with close date before first update
sysdate1
Valid
Know
01.01.2016
A
A
sysdate2
06.06.2016
B
4747
Update the past with close date before first update
sysdate1
Valid
Know
01.01.2016
A
A
sysdate2
06.06.2016
B
sysdate3
C
03.03.2016 09.09.2016
A A
04.04.2016
4848
Update the past with close date before first update
Action Data Valid From Valid Till Known From Known Till
Update A - - - sysdate
Keep B - - - -
Insert C 03.03.2016 04.04.2016 sysdate 31.12.9999
Insert A 01.01.2016 03.03.2016 sysdate 31.12.9999
Insert A 04.04.2016 06.06.2016 sysdate 31.12.9999
4949
When to use
Ask yourself two questions:
▪ Does your business need to know the situation as it was known at a particular
date?
▪ Does your business use information that was effective in the past or will become
effective in the future?
⇒ If you answer YES on one or both of these question then your data varies
over time and you could consider adopting a temporal approach.
5050
Q&A
5151
5252
References
▪ http://www.datasciencecentral.com/profiles/blogs/temporal-databases-why-
you-should-care-and-how-to-get-started (3 parts)
▪ https://www.linkedin.com/pulse/emerging-data-design-bitemporal-mike-
lapenna (2 parts)
▪ Kudos to my ex-colleagues.
5353
IT SecurityNEVISIT Consulting Application
Management
Software Solutions
Linh Chau, Software Engineer
linh.chau@adnovum.ch
www.adnovum.ch

More Related Content

PPTX
Druid - DevconTLV X
PDF
Tracking your data across the fourth dimension
PDF
Track your data across the fourth dimension
PPT
tempDB.ppt
PDF
Tracking your data across the fourth dimension
PPT
Temporal
PDF
Unit 5_ Advanced Database Models, Systems, and Applications.pdf
PPTX
Temporal databases
Druid - DevconTLV X
Tracking your data across the fourth dimension
Track your data across the fourth dimension
tempDB.ppt
Tracking your data across the fourth dimension
Temporal
Unit 5_ Advanced Database Models, Systems, and Applications.pdf
Temporal databases

Similar to Temporal database (20)

PDF
Checking and verifying temporal data
PDF
MariaDB Temporal Tables
PDF
Time Travelling With DB2 10 For zOS
ODP
Bi-temporal rdbms 2014
PPTX
Back to the future - Temporal Table in SQL Server 2016
PPTX
Data warehousing and Data Mining
PDF
call for papers, research paper publishing, where to publish research paper, ...
PDF
MarkLogic White Paper Better With Bitemporal (Interactive)
PDF
Temporal Case Management 1998
PDF
MariaDB Temporal Tables
PDF
Temporal Data
PDF
BI-TEMPORAL IMPLEMENTATION IN RELATIONAL DATABASE MANAGEMENT SYSTEMS: MS SQ...
PPT
Teradata 13.10
PDF
Webinar - MariaDB Temporal Tables: a demonstration
PDF
SQLSat462 Parma 2015
PDF
Oracle 12c Application development
PDF
Temporal database
PDF
Temporal Databases: Queries
PDF
Management of Bi-Temporal Properties of Sql/Nosql Based Architectures – A Re...
PDF
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Checking and verifying temporal data
MariaDB Temporal Tables
Time Travelling With DB2 10 For zOS
Bi-temporal rdbms 2014
Back to the future - Temporal Table in SQL Server 2016
Data warehousing and Data Mining
call for papers, research paper publishing, where to publish research paper, ...
MarkLogic White Paper Better With Bitemporal (Interactive)
Temporal Case Management 1998
MariaDB Temporal Tables
Temporal Data
BI-TEMPORAL IMPLEMENTATION IN RELATIONAL DATABASE MANAGEMENT SYSTEMS: MS SQ...
Teradata 13.10
Webinar - MariaDB Temporal Tables: a demonstration
SQLSat462 Parma 2015
Oracle 12c Application development
Temporal database
Temporal Databases: Queries
Management of Bi-Temporal Properties of Sql/Nosql Based Architectures – A Re...
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Ad

Recently uploaded (20)

PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
Online Work Permit System for Fast Permit Processing
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
medical staffing services at VALiNTRY
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
ai tools demonstartion for schools and inter college
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
System and Network Administraation Chapter 3
PPTX
Transform Your Business with a Software ERP System
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PTS Company Brochure 2025 (1).pdf.......
Which alternative to Crystal Reports is best for small or large businesses.pdf
Odoo POS Development Services by CandidRoot Solutions
Online Work Permit System for Fast Permit Processing
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
ManageIQ - Sprint 268 Review - Slide Deck
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
medical staffing services at VALiNTRY
ISO 45001 Occupational Health and Safety Management System
Internet Downloader Manager (IDM) Crack 6.42 Build 41
ai tools demonstartion for schools and inter college
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
System and Network Administraation Chapter 3
Transform Your Business with a Software ERP System
Softaken Excel to vCard Converter Software.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Ad

Temporal database