Presentation is loading. Please wait.

Presentation is loading. Please wait.

A time travel With temporal tables Leonel Abreu

Similar presentations


Presentation on theme: "A time travel With temporal tables Leonel Abreu"— Presentation transcript:

1 A time travel With temporal tables Leonel Abreu leonel.abreu@gmail.com

2 Our Sponsors If you think, that a SQL Saturday is a nice possibility to learn from and network with fellow SQL Server enthusiasts FOR FREE, I just ask you one thing: Visit the sponsor booths and chat with the sponsors! They are covering the expenses for each and every of you, with is around EUR 60 …

3 Agenda What’s a Temporal Table? It’s useful for A Short “How to”
Advantages and how to use it It’s useful for Auditing efects Disaster Recovery Trending Analytics A Short “How to” Scenario and demo

4 What is a temporal table?
Also known as System Versioned Because keep changes Just two extra columns To define periods Finally a second table Which contains the history

5 How does it work? Source:

6 How does it work? Source:

7 Advantages Security Easy to maintain Can be used
Is not possible to modify the historical data Easy to maintain Additional coding to insert/update/delete data is not required Can be used For new tables For existing tables

8 Why temporal tables? Auditing Time Travel Recovering
All data changes and forensics if necessary Time Travel State of data as of any time in the past Recovering From accidental data changes, as undesired DELETE operations

9 Why temporal tables? Calculate Also BI Schema included
Trends over time Also BI Can be used to do SCD Schema included If the table structure is changed, it is also recorded

10 Why temporal tables? Real data sources are dynamic
9/4/2018 7:12 PM Why temporal tables? Real data sources are dynamic Historical data may be critical to business success Traditional databases fail to provide required insights Workarounds are… Complex, expensive, limited, inflexible, inefficient SQL Server 2016 makes life easy No change in programming model New Insights © 2014 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

11 Why temporal tables? Azure SQL Database Facts: Solution:
Microsoft Ignite 2015 9/4/2018 7:12 PM Why temporal tables? Facts: History is much bigger than actual data Retained between 3 and 10 years “Warm”: up to a few weeks/months “Cold”: rarely queried SELECT * FROM Department FOR SYSTEM_TIME AS OF ' ' Azure SQL Database Solution: history as a stretch table: PeriodEnd < “Now - 6 months” © 2015 Microsoft Corporation. All rights reserved. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

12 How to implement it? Source:

13 How to implement it?

14 Query Clauses AS OF FROM TO SysStartTime SysStartTime <= date_time
SysEndTime > date_time FROM TO SysStartTime < end_date_time SysEndTime > start_date_time

15 Query Clauses BETWEEN AND CONTAINED IN ALL
SysStartTime <= end_date_time SysEndTime > start_date_time CONTAINED IN SysStartTime >= end_date_time SysEndTime <= start_date_time ALL Returns the union between the current and history table

16 Schaumamal SVT

17 Q & A

18 Please give us feedback!
How did you like it? Please give us feedback! to the event: to me as a speaker:

19 Ressources SQL Server 2016 in 15 Minuten SQL PASS Austria Homepage
SQL PASS Austria Homepage SQL PASS Austria Meeting Archive

20 Thank You! If you think, that a SQL Saturday is a nice possibility to learn from and network with fellow SQL Server enthusiasts FOR FREE, I just ask you one thing: Visit the sponsor booths and chat with the sponsors! They are covering the expenses for each and every of you, with is around EUR 60 …


Download ppt "A time travel With temporal tables Leonel Abreu"

Similar presentations


Ads by Google