SlideShare uma empresa Scribd logo
1 de 53
Baixar para ler offline
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

Mais conteúdo relacionado

Semelhante a Temporal database

Operational Intelligence with WSO2 BAM
Operational Intelligence with WSO2 BAM Operational Intelligence with WSO2 BAM
Operational Intelligence with WSO2 BAM
WSO2
 
Swedish_Technology_Audit_Trail
Swedish_Technology_Audit_TrailSwedish_Technology_Audit_Trail
Swedish_Technology_Audit_Trail
Swedish Technology
 
Data Privacy Patterns in databricks for data engineering professional certifi...
Data Privacy Patterns in databricks for data engineering professional certifi...Data Privacy Patterns in databricks for data engineering professional certifi...
Data Privacy Patterns in databricks for data engineering professional certifi...
TusharAgarwal49094
 

Semelhante a Temporal database (17)

The In(put)s and Out(put)s of Suggestive Purchasing
The In(put)s and Out(put)s of Suggestive PurchasingThe In(put)s and Out(put)s of Suggestive Purchasing
The In(put)s and Out(put)s of Suggestive Purchasing
 
Architecting for Big Data with AWS
Architecting for Big Data with AWSArchitecting for Big Data with AWS
Architecting for Big Data with AWS
 
Data Wrangling: Working with Date / Time Data and Visualizing It
Data Wrangling: Working with Date / Time Data and Visualizing ItData Wrangling: Working with Date / Time Data and Visualizing It
Data Wrangling: Working with Date / Time Data and Visualizing It
 
Data Warehousing (Practical Questions Paper) [CBSGS - 75:25 Pattern] {2016-20...
Data Warehousing (Practical Questions Paper) [CBSGS - 75:25 Pattern] {2016-20...Data Warehousing (Practical Questions Paper) [CBSGS - 75:25 Pattern] {2016-20...
Data Warehousing (Practical Questions Paper) [CBSGS - 75:25 Pattern] {2016-20...
 
Modern data warehouse presentation
Modern data warehouse presentationModern data warehouse presentation
Modern data warehouse presentation
 
Cloud Cost Management and Apache Spark with Xuan Wang
Cloud Cost Management and Apache Spark with Xuan WangCloud Cost Management and Apache Spark with Xuan Wang
Cloud Cost Management and Apache Spark with Xuan Wang
 
Managing Agile Software Development Quantitatively
Managing Agile Software Development QuantitativelyManaging Agile Software Development Quantitatively
Managing Agile Software Development Quantitatively
 
Cassandra Day SV 2014: Fundamentals of Apache Cassandra Data Modeling
Cassandra Day SV 2014: Fundamentals of Apache Cassandra Data ModelingCassandra Day SV 2014: Fundamentals of Apache Cassandra Data Modeling
Cassandra Day SV 2014: Fundamentals of Apache Cassandra Data Modeling
 
Operational Intelligence with WSO2 BAM
Operational Intelligence with WSO2 BAM Operational Intelligence with WSO2 BAM
Operational Intelligence with WSO2 BAM
 
Amazon GT master data science challenge 2020 presentation
Amazon GT master data science challenge 2020 presentationAmazon GT master data science challenge 2020 presentation
Amazon GT master data science challenge 2020 presentation
 
Nagios Conference 2012 - Anders Haal - Why dynamic and adaptive thresholds ma...
Nagios Conference 2012 - Anders Haal - Why dynamic and adaptive thresholds ma...Nagios Conference 2012 - Anders Haal - Why dynamic and adaptive thresholds ma...
Nagios Conference 2012 - Anders Haal - Why dynamic and adaptive thresholds ma...
 
Swedish_Technology_Audit_Trail
Swedish_Technology_Audit_TrailSwedish_Technology_Audit_Trail
Swedish_Technology_Audit_Trail
 
Lean Six Sigma Course Training Part 4
Lean Six Sigma Course Training Part 4Lean Six Sigma Course Training Part 4
Lean Six Sigma Course Training Part 4
 
Data warehousing PRACTICAL (Sem - VI)
Data warehousing PRACTICAL (Sem - VI)Data warehousing PRACTICAL (Sem - VI)
Data warehousing PRACTICAL (Sem - VI)
 
Data Warehouse Like a Tech Startup with Oracle Autonomous Data Warehouse
Data Warehouse Like a Tech Startup with Oracle Autonomous Data WarehouseData Warehouse Like a Tech Startup with Oracle Autonomous Data Warehouse
Data Warehouse Like a Tech Startup with Oracle Autonomous Data Warehouse
 
Data Privacy Patterns in databricks for data engineering professional certifi...
Data Privacy Patterns in databricks for data engineering professional certifi...Data Privacy Patterns in databricks for data engineering professional certifi...
Data Privacy Patterns in databricks for data engineering professional certifi...
 
Les objets connectés : de nombreux cas d'usage
Les objets connectés : de nombreux cas d'usage Les objets connectés : de nombreux cas d'usage
Les objets connectés : de nombreux cas d'usage
 

Último

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 

Temporal database