SlideShare una empresa de Scribd logo
1 de 22
Descargar para leer sin conexión
An Overview of Temporal Features in SQL:2011

     Craig Baumunk, January 4, 2012




                                               1
Agenda
•   SQL Standards Process Overview

•   Temporal features in standard SQL history

•   Temporal data overview

•   Things to know about temporal features in SQL:2011

•   Application time period tables

•   System versioned tables

•   Application time period tables with system versioning (bitemporal tables)

•   Next Steps

                                                                                2
SQL Standards Process Overview

   •   INCITS DM32.2 (formerly X3H2) is responsible for SQL standard in US
         – International Committee for Information Technology Standards) is an ANSI (American
            National Standards Institute) accredited standards producing organization
   •   ISO/IEC JTC 1/SC 32 Data Management and Interchange/WG 3 committee is responsible for
       SQL Standard Internationally
   •   Much of the new capabilities in the SQL standard have originated in the US
         – Approval by DM32.2 before submission to WG3
         – Published by ISO then adopted as US standards by INCITS
   •   Typically 3 to 5 year cycle
   •   SQL is a multi-part standard which currently has 9 parts
         – The highest part number is currently 14 (parts 5, 6, 7, 8 &12) were terminated
         – Part 2: SQL/Foundation is the SQL language specification (biggest/most important part)
   •   Documentation of DM32.2 works in progress are not publicly available
   •   Anyone can join DM32 as an observer for $1,200 and get documentation of works in progress and
       what is approved but not yet published etc
   •   7 Versions of Standard SQL
         – 86 (SQL-87), 89, 92(SQL2), SQL:1999 (SQL3), SQL:2003, SQL:2008, SQL:2011


* Disclaimer: I am not and never been a member of X3H2 or INCITS DM32.2 personally
                                                                                                       3
Temporal Features First Attempt 1995 - 2001


•   X3H2 (now DM32.2) and WG 3 both approved work on a new part of SQL standard called
    SQL/Temporal in 1995
•   US made the first proposal on adding the new SQL extensions, largely based on the pioneering
    work of Prof. Rick Snodgrass of Univ. of Arizona
•   The US proposal was based on TSQL2, an extension of SQL-92, put together by a team headed
    by Prof. Snodgrass
•   The US proposal proved to be controversial at ISO. Some of the ISO members felt there were
    some serious problems with the US proposal
•   The UK brought in a competing proposal based on the work of Prof. Nikos Lorentzos of Univ.
    Athens, Greece
•   The US disagreed with the ISO comments on the US proposal. And the US also did not see the
    need for the UK proposal
•   Because of the controversy, both ANSI and ISO decided to defer further work on SQL/Temporal
    until SQL:99 was published
•   After the publication of SQL:99, neither US nor UK brought in any new proposals to resolve the
    differences
•   Because of inactivity, both ANSI and ISO decided to cancel SQL/Temporal part in 2001



                                                                                                     4
Temporal Features Second Attempt 2008 - 2011


•   A second attempt at adding temporal features to the SQL standard was made in
    2008. It started with the acceptance of a proposal on "system-versioned tables"
    by both INCITS DM32.2 and ISO/IEC JTC1 SC32 WG3. Rather than
    resurrecting SQL/Temporal, this proposal added the temporal extensions to
    SQL/Foundation.

•   Another temporal feature was added in 2010 in the form of "application-time
    period tables”.

•   Both system-versioned tables and application-time period tables are now part of
    the new version of the SQL standard (SQL:2011) which was approved and
    published in 2011.

•   The temporal features in SQL:2011 are largely inspired by the earlier proposals
    considered during the first attempt but with a substantially different syntax.



                                                                                      5
Temporal Data



   Temporal data is data which changes over time
     •  A company’s credit rating changes over time
          •    Referred to as valid time dimension, real world perspective or business perspective
          •    SQL:2011 calls this application time
     •  The value we have in a database for a company’s credit rating changes over time
          •    This may be different than application time due to timing differences
          •    This may have nothing to do with the application time perspective (for example corrections)
          •    Referred to as transaction time dimension or database perspective
          •    SQL:2011 calls this system time (or system versioning)

   Most data is temporal
     •   Most common dimensions are application time and system time (focus of temporal features of SQL:2011)

   It is helpful to think of non-temporal data as a trivial case of temporal data
      •    Non-temporal data would be data which does not change (in real life, in a system, or we do not store a
           history of changes in a database)

   Bitemporal data is data which changes over 2 dimensions of time independently
     •   SQL:2011 calls this application time with system versioning



                                                                                                                    6
4 Types of tables


                                     No Application Time History     Application Time History
     No System Time History          Non-temporal                    Application time period table
     System Time History             System versioned table          System versioned application
                                                                     time period table


   Non-temporal tables
     • Conventional tables (without date/timestamp in PK)
     • Latest information, without any history

   Application time period tables
     • History of how data changed from an application time perspective as we know it now

   System versioned tables
     • History of how current data from a application time perspective changed in the system
       (database)

   System versioned application time period tables
     • History, of how history from an application time perspective, changed in the system (database)

                                                                                                        7
Things to know about temporal features in
                               SQL:2011
   Row based versioning
     • In contrast to column based versioning
     • But can be use to implement column based versioning

   State based storage
     • 2 timestamps for application time periods
     • 2 timestamps for system time periods
     • 4 timestamps for system versioned application time period tables

   State based inputs
     • User provides application period start AND application period end
     • Users do NOT provide system period start or end
           • Insert, update, and delete events are converted to states (till high datetime)

   Time periods use the Closed – Open convention
     • AKA inclusive – exclusive
     • Supports unambiguous comparisons with different precisions

   The strengths of the temporal features in SQL:2011 are:
     • Ease of migration (not dependent on period data type)
     • Fits well with SQL semantics (no statement modifiers)
     • Lots of user control (can update application start/end directly)
     • Compatibility (existing queries work against system versioned tables)
                                                                                              8
Primary Keys for 4 Types of Tables



   Non-temporal storage
     • No date/timestamp in PK

   Application time period table
     • 2 timestamps (Application Period Start & Application Period End) is not enough
     • Application time periods can not overlap for the same object

   System versioned table
     • System time periods should not overlap for the same object (but this is not part of the PK)
     • 2 rows for the same object can not have the same system start (constraint)
          • Transaction time is defined by implementation (high level of precision)
          • Transaction times should be sequential

   System versioned application time period table
     • Application time periods can overlap for the same object
     • System time periods can overlap for the same object
     • BOTH application time period AND system time period should NOT overlap for the same
       object

                                                                                                     9
Application time period tables

•   Table definition
      – Define columns for application period start and end (need to be a date/timestamp data types and not null)
      – New PERIOD clause specifies what columns implement an application time period and creates an implicit
           constraint that application time period start < application time period end (pick your period name)
      – New WITHOUT OVERLAPS keywords in PRIMARY KEY clause ensures that application time periods do
           not overlap
      – FOREIGN KEY clause extended to include referencing of period in parent table
•   Inserting
      – Normal syntax
              • Comply with constraints ( start and end not null, start < end, no overlaps)
•   Deletes
      – Delete rows with normal syntax
              • Constrain on application time period start and end as desired or not !
      – Delete using FOR PORTION OF application time period FROM DATE XXXX/XX/XX TO DATE XXXX/XX/XX
           clause results in automatic “row splitting”
•   Updates
      – Update rows with normal syntax (including application time period start and end columns)
              • Comply with constraints (start and end not null, start < end, no overlaps)
              • Constrain on application time period start and end as desired or not !
      – Update using FOR PORTION OF application time period FROM DATE XXXX/XX/XX TO DATE
           XXXX/XX/XX clause results in automatic “row splitting”
              • Can’t update application period start or end using this option
•   Select
      – Normal Syntax (application time period start and end can be used since they are explicit columns)
                                                                                                                    10
Application time period tables – Delete row splitting
             - 4 types of existing time slices -




• There can be multiple types of existing time slices for a delete range
• No error if delete over a range where no values


                                                                           11
Application time period tables – Update row splitting
                - 4 types of existing time slices -




• There can be multiple types of existing time slices for a update range
• No error if update over a range where no values
• An update can cause multiple contiguous time slices to have the same non PK data
values (unpacked)
                                                                                     12
System versioned tables

•   Table definition
      – Define columns for system time period start and end (need to be date/timestamp data type and not null) with new
           GENERATE ALWAYS AS ROW BEGIN/END clause
      – New PERIOD clause with SYSTEM_TIME period name specifies what columns are in the system time period
           (system time period start < system time period end does not need to be enforced)
      – New WITH SYSTEM VERSIONING clause implicitly adds system time period start to primary key
      – Constraints only apply to rows which are not logically deleted
      – Referential Integrity is not impacted
•   Inserting
      – Normal syntax but never specify system time period start or end columns as they are generated
      – New time slices of data have system time period start = insert transaction time and system period end = high
           date/time
•   Deletes
      – Normal syntax but a history of what data was deleted and when it was deleted is maintained automatically
      – Deleted time slices of data have system period end = delete transaction time (logically deleted)
      – Only rows which are not logically deleted can be deleted
•   Updates
      – Normal syntax but a history of what data was updated and when it was updated is maintained automatically
      – Updated time slices of data have system period end = update transaction time (logically deleted)
      – Only rows which are not logically deleted can be updated
•   Select
      – Normal syntax works as if non-temporal table (do not query logically deleted rows)
      – New as-of, between, and from clauses are available to query all rows in the table
              • Including logically deleted rows
                                                                                                                   13
System versioned tables – Delete history
                               - 1 type of existing time slice -




                                                                                                Not logically
                                                                                                  deleted


 Delete range begin =
Delete transaction time                                                                         Delete range end =
                                                                                                High date/timestamp



     Logically deleted




   • There is only 1 type of existing time slice for a delete range
   • There can only be 1 time slice of interest for an object (that is not logically deleted)




                                                                                                                      14
System versioned tables – Update History
                               - 1 type of existing time slices -




                                                                                              Not logically
                                                                                                deleted


 Delete range begin =
Delete transaction time                                                                       Delete range end =
                                                                                              High date/timestamp


                                                                                              Not logically
     Logically deleted
                                                                                                deleted




 • There can only be 1 type of existing time slice for an update range
 • There can only be 1 time slice of interest for an object (that is not logically deleted)




                                                                                                                    15
System versioned application time period tables


•   Table definition
     –   Define columns for application time period start and end (need to be date/timestamp data types and not null)
     –   Define columns for system time period start and end (need to be date/timestamp data types and not null)
         with new GENERATE ALWAYS AS ROW BEGIN/END clause
     –   New PERIOD clause to specifies what columns are in the application time period
     –   New PERIOD clause with SYSTEM_TIME keyword specifies what columns are in system time period
     –   New WITHOUT OVERLAPS keyword in PRIMARY KEY clause ensures that application time periods do not
         overlap
     –   New WITH SYSTEM VERSIONING clause implicitly adds system time period start to primary key
     –   Constraints only apply to rows which are not logically deleted
     –   FOREIGN KEY clause extended to include referencing of period in parent table
•   Inserting
     –   Same as application time period tables but never specify system time period start or end columns as they
         are generated
•   Deletes
     –   Same as application time period tables but a history of what was deleted and when it was deleted is
         maintained automatically (rows)
     –   Only rows which are not logically deleted can be deleted
•   Updates
     –   Same as application time period tables but a history of what was updated and when it was updated is
         maintained automatically (rows)
     –   Only rows which are not logically deleted can be updated
•   Select
     –   Same as application period tables
     –   New as-of, between, and from clauses are available to query all rows in the table
           • Including logically deleted rows

                                                                                                                        16
Bitemporal tables – Delete splitting & history
              - 4 types of existing application time slices -




• Same as application time period table deletes except update existing time slices instead of
delete because:
      • Only 1 type of existing row from system versioning perspective
      • Application time period table delete splitting results in inserts and deletes
      • System versioning does not do any splitting for inserts
      • System versioning changes deletes into updates
                                                                                                17
Bitemporal tables – Update splitting & history
              - 4 types of existing application time slices -




• Same as application time period table updates except additional insert of existing time slice
because:
     • Only 1 type of existing row from system versioning perspective
     • Application time period table update row splitting results in inserts and updates
     • System versioning does not do any splitting for inserts
     • System versioning changes updates into an update AND an insert
                                                                                                  18
Summary & Conclusions



• Significant new temporal features have been included in SQL:2011
• Temporal features represent a significant extension to the SQL
  language that will take time for people to utilize
• Vendors are beginning to adopt these features
• Methodology for how to utilize new temporal features of SQL will
  probably be a factor in utilization
• Time will tell how much the SQL:2011 temporal extensions are
  utilized
• Implications of temporal extensions on replication, partitioning,
  archiving etc are still being sorted




                                                                      19
Next Steps



•   Actual syntax

•   Examples, Examples and more examples

•   Advanced topics
     –   Temporal predicates
     –   Joining different types of temporal tables
     –   Referential integrity implications
     –   Schema migration implications

•   Where are vendors with compliance/adoption

•   How vendors CAN comply but also differentiate

•   How vendors ARE differentiating


                                                      20
Resources




 Search YouTube.com for “Case for Bitemporal Data”
    http://www.youtube.com/playlist?list=PL4CB3C8161D2804E6

 TemporalData.com

 “Temporal Data” LinkedIn group
    http://www.linkedin.com/groups?gid=3885228

 http://stacresearch.com/btd
    Functional and performance benchmarks


                                                               21
THANK YOU!


USA                            UK

BitemporalData.com LLC         BitemporalData Ltd
1330 Route 206                 Suite 13493, 2nd floor
Suite 318                      145-157 St John Street
Skillman, NJ 08558             London EC1V 4PY


Tel: +1.201.332.5000           Tel: +44.20.3318.5919




                                                        22

Más contenido relacionado

La actualidad más candente

Intro to Reactive Programming
Intro to Reactive ProgrammingIntro to Reactive Programming
Intro to Reactive ProgrammingStéphane Maldini
 
Choking the monolith - The Strangler (Fig) Pattern Applied
Choking the monolith - The Strangler (Fig) Pattern AppliedChoking the monolith - The Strangler (Fig) Pattern Applied
Choking the monolith - The Strangler (Fig) Pattern AppliedTobiasGoeschel
 
Python: Common Design Patterns
Python: Common Design PatternsPython: Common Design Patterns
Python: Common Design PatternsDamian T. Gordon
 
Introduction to Gitlab
Introduction to GitlabIntroduction to Gitlab
Introduction to GitlabJulien Pivotto
 
Rational unified process (rup)
Rational unified process (rup)Rational unified process (rup)
Rational unified process (rup)kdore
 
Migration vers Active Directory 2012 et 2012 R2 : les meilleures pratiques
Migration vers Active Directory 2012 et 2012 R2 : les meilleures pratiques Migration vers Active Directory 2012 et 2012 R2 : les meilleures pratiques
Migration vers Active Directory 2012 et 2012 R2 : les meilleures pratiques Microsoft Technet France
 
Trunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development in the Enterprise - Its Relevance and EconomicsTrunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development in the Enterprise - Its Relevance and EconomicsPerforce
 
Feature Driven Development
Feature Driven DevelopmentFeature Driven Development
Feature Driven Developmentdcsunu
 
19 features you will miss if you leave Oracle Database
19 features you will miss if you leave Oracle Database19 features you will miss if you leave Oracle Database
19 features you will miss if you leave Oracle DatabaseFranck Pachot
 
Software life cycle
Software life cycleSoftware life cycle
Software life cyclekingseif
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with GitLuigi De Russis
 
Action Jackson! Effective JSON processing in Spring Boot Applications
Action Jackson! Effective JSON processing in Spring Boot ApplicationsAction Jackson! Effective JSON processing in Spring Boot Applications
Action Jackson! Effective JSON processing in Spring Boot ApplicationsJoris Kuipers
 
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Noa Harel
 

La actualidad más candente (20)

Intro to Reactive Programming
Intro to Reactive ProgrammingIntro to Reactive Programming
Intro to Reactive Programming
 
Choking the monolith - The Strangler (Fig) Pattern Applied
Choking the monolith - The Strangler (Fig) Pattern AppliedChoking the monolith - The Strangler (Fig) Pattern Applied
Choking the monolith - The Strangler (Fig) Pattern Applied
 
GIT INTRODUCTION
GIT INTRODUCTIONGIT INTRODUCTION
GIT INTRODUCTION
 
Python: Common Design Patterns
Python: Common Design PatternsPython: Common Design Patterns
Python: Common Design Patterns
 
Introduction to Gitlab
Introduction to GitlabIntroduction to Gitlab
Introduction to Gitlab
 
GitLab.pptx
GitLab.pptxGitLab.pptx
GitLab.pptx
 
Regression testing
Regression testingRegression testing
Regression testing
 
Rational unified process (rup)
Rational unified process (rup)Rational unified process (rup)
Rational unified process (rup)
 
Migration vers Active Directory 2012 et 2012 R2 : les meilleures pratiques
Migration vers Active Directory 2012 et 2012 R2 : les meilleures pratiques Migration vers Active Directory 2012 et 2012 R2 : les meilleures pratiques
Migration vers Active Directory 2012 et 2012 R2 : les meilleures pratiques
 
Agile modeling
Agile modelingAgile modeling
Agile modeling
 
Trunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development in the Enterprise - Its Relevance and EconomicsTrunk Based Development in the Enterprise - Its Relevance and Economics
Trunk Based Development in the Enterprise - Its Relevance and Economics
 
Feature Driven Development
Feature Driven DevelopmentFeature Driven Development
Feature Driven Development
 
19 features you will miss if you leave Oracle Database
19 features you will miss if you leave Oracle Database19 features you will miss if you leave Oracle Database
19 features you will miss if you leave Oracle Database
 
Software life cycle
Software life cycleSoftware life cycle
Software life cycle
 
Requirements Engineering
Requirements EngineeringRequirements Engineering
Requirements Engineering
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
 
Action Jackson! Effective JSON processing in Spring Boot Applications
Action Jackson! Effective JSON processing in Spring Boot ApplicationsAction Jackson! Effective JSON processing in Spring Boot Applications
Action Jackson! Effective JSON processing in Spring Boot Applications
 
Intro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucketIntro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucket
 
Istqb lesson 1
Istqb lesson 1Istqb lesson 1
Istqb lesson 1
 
Introducing GitLab (September 2018)
Introducing GitLab (September 2018)Introducing GitLab (September 2018)
Introducing GitLab (September 2018)
 

Similar a An Overview of Temporal Features in SQL:2011

T sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powersT sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powersShehap Elnagar
 
Un it 2-se-mod-staff
Un it 2-se-mod-staffUn it 2-se-mod-staff
Un it 2-se-mod-staffvijisvs2012
 
T sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powersT sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powersShehap Elnagar
 
T sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powersT sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powersShehap Elnagar
 
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaPerfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaCuneyt Goksu
 
Time Travelling With DB2 10 For zOS
Time Travelling With DB2 10 For zOSTime Travelling With DB2 10 For zOS
Time Travelling With DB2 10 For zOSLaura Hood
 
Database applicationtesting
Database applicationtestingDatabase applicationtesting
Database applicationtestingRenuka Ballal
 
Software Configuration Management.pptx
Software Configuration Management.pptxSoftware Configuration Management.pptx
Software Configuration Management.pptxMaSheilaMagboo
 
System development
System developmentSystem development
System developmentPraveen Minz
 
SKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSING
SKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSINGSKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSING
SKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSINGSkillwise Group
 
Oracle11g R2 - Edition Based Redefinition for On Line Application Upgrade
Oracle11g R2 - Edition Based Redefinition for On Line Application UpgradeOracle11g R2 - Edition Based Redefinition for On Line Application Upgrade
Oracle11g R2 - Edition Based Redefinition for On Line Application UpgradeLucas Jellema
 
2 approaches to system development
2 approaches to system development2 approaches to system development
2 approaches to system developmentcymark09
 
6. FUNDAMENTALS OF SE AND REQUIREMENT ENGINEERING.ppt
6. FUNDAMENTALS OF SE AND REQUIREMENT ENGINEERING.ppt6. FUNDAMENTALS OF SE AND REQUIREMENT ENGINEERING.ppt
6. FUNDAMENTALS OF SE AND REQUIREMENT ENGINEERING.pptPedadaSaikumar
 
Openstack upgrade without_down_time_20141103r1
Openstack upgrade without_down_time_20141103r1Openstack upgrade without_down_time_20141103r1
Openstack upgrade without_down_time_20141103r1Yankai Liu
 
Software engineering.pptx
Software engineering.pptxSoftware engineering.pptx
Software engineering.pptxProvatMajhi
 
Types of Operating System
Types of Operating System Types of Operating System
Types of Operating System Rianchaljha
 
Software Configuration Management
Software Configuration ManagementSoftware Configuration Management
Software Configuration ManagementJeyanthiR
 

Similar a An Overview of Temporal Features in SQL:2011 (20)

T sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powersT sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powers
 
Un it 2-se-mod-staff
Un it 2-se-mod-staffUn it 2-se-mod-staff
Un it 2-se-mod-staff
 
T sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powersT sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powers
 
T sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powersT sql performance guidelines for better db stress powers
T sql performance guidelines for better db stress powers
 
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaaPerfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
Perfect trio : temporal tables, transparent archiving in db2 for z_os and idaa
 
Time Travelling With DB2 10 For zOS
Time Travelling With DB2 10 For zOSTime Travelling With DB2 10 For zOS
Time Travelling With DB2 10 For zOS
 
Database applicationtesting
Database applicationtestingDatabase applicationtesting
Database applicationtesting
 
Software Configuration Management.pptx
Software Configuration Management.pptxSoftware Configuration Management.pptx
Software Configuration Management.pptx
 
System development
System developmentSystem development
System development
 
Project scheduler doc
Project scheduler docProject scheduler doc
Project scheduler doc
 
SKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSING
SKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSINGSKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSING
SKILLWISE-SSIS DESIGN PATTERN FOR DATA WAREHOUSING
 
SDLC
SDLC SDLC
SDLC
 
Oracle11g R2 - Edition Based Redefinition for On Line Application Upgrade
Oracle11g R2 - Edition Based Redefinition for On Line Application UpgradeOracle11g R2 - Edition Based Redefinition for On Line Application Upgrade
Oracle11g R2 - Edition Based Redefinition for On Line Application Upgrade
 
2 approaches to system development
2 approaches to system development2 approaches to system development
2 approaches to system development
 
Pawan111
Pawan111Pawan111
Pawan111
 
6. FUNDAMENTALS OF SE AND REQUIREMENT ENGINEERING.ppt
6. FUNDAMENTALS OF SE AND REQUIREMENT ENGINEERING.ppt6. FUNDAMENTALS OF SE AND REQUIREMENT ENGINEERING.ppt
6. FUNDAMENTALS OF SE AND REQUIREMENT ENGINEERING.ppt
 
Openstack upgrade without_down_time_20141103r1
Openstack upgrade without_down_time_20141103r1Openstack upgrade without_down_time_20141103r1
Openstack upgrade without_down_time_20141103r1
 
Software engineering.pptx
Software engineering.pptxSoftware engineering.pptx
Software engineering.pptx
 
Types of Operating System
Types of Operating System Types of Operating System
Types of Operating System
 
Software Configuration Management
Software Configuration ManagementSoftware Configuration Management
Software Configuration Management
 

Último

The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch TuesdayIvanti
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!Memoori
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTopCSSGallery
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
How to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in PakistanHow to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in Pakistandanishmna97
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftshyamraj55
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxFIDO Alliance
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...ScyllaDB
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuidePixlogix Infotech
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimaginedpanagenda
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxFIDO Alliance
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxMasterG
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهMohamed Sweelam
 

Último (20)

The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!State of the Smart Building Startup Landscape 2024!
State of the Smart Building Startup Landscape 2024!
 
Top 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development CompaniesTop 10 CodeIgniter Development Companies
Top 10 CodeIgniter Development Companies
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
How to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in PakistanHow to Check GPS Location with a Live Tracker in Pakistan
How to Check GPS Location with a Live Tracker in Pakistan
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
JavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate GuideJavaScript Usage Statistics 2024 - The Ultimate Guide
JavaScript Usage Statistics 2024 - The Ultimate Guide
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptxCyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
Cyber Insurance - RalphGilot - Embry-Riddle Aeronautical University.pptx
 
الأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهلهالأمن السيبراني - ما لا يسع للمستخدم جهله
الأمن السيبراني - ما لا يسع للمستخدم جهله
 

An Overview of Temporal Features in SQL:2011

  • 1. An Overview of Temporal Features in SQL:2011 Craig Baumunk, January 4, 2012 1
  • 2. Agenda • SQL Standards Process Overview • Temporal features in standard SQL history • Temporal data overview • Things to know about temporal features in SQL:2011 • Application time period tables • System versioned tables • Application time period tables with system versioning (bitemporal tables) • Next Steps 2
  • 3. SQL Standards Process Overview • INCITS DM32.2 (formerly X3H2) is responsible for SQL standard in US – International Committee for Information Technology Standards) is an ANSI (American National Standards Institute) accredited standards producing organization • ISO/IEC JTC 1/SC 32 Data Management and Interchange/WG 3 committee is responsible for SQL Standard Internationally • Much of the new capabilities in the SQL standard have originated in the US – Approval by DM32.2 before submission to WG3 – Published by ISO then adopted as US standards by INCITS • Typically 3 to 5 year cycle • SQL is a multi-part standard which currently has 9 parts – The highest part number is currently 14 (parts 5, 6, 7, 8 &12) were terminated – Part 2: SQL/Foundation is the SQL language specification (biggest/most important part) • Documentation of DM32.2 works in progress are not publicly available • Anyone can join DM32 as an observer for $1,200 and get documentation of works in progress and what is approved but not yet published etc • 7 Versions of Standard SQL – 86 (SQL-87), 89, 92(SQL2), SQL:1999 (SQL3), SQL:2003, SQL:2008, SQL:2011 * Disclaimer: I am not and never been a member of X3H2 or INCITS DM32.2 personally 3
  • 4. Temporal Features First Attempt 1995 - 2001 • X3H2 (now DM32.2) and WG 3 both approved work on a new part of SQL standard called SQL/Temporal in 1995 • US made the first proposal on adding the new SQL extensions, largely based on the pioneering work of Prof. Rick Snodgrass of Univ. of Arizona • The US proposal was based on TSQL2, an extension of SQL-92, put together by a team headed by Prof. Snodgrass • The US proposal proved to be controversial at ISO. Some of the ISO members felt there were some serious problems with the US proposal • The UK brought in a competing proposal based on the work of Prof. Nikos Lorentzos of Univ. Athens, Greece • The US disagreed with the ISO comments on the US proposal. And the US also did not see the need for the UK proposal • Because of the controversy, both ANSI and ISO decided to defer further work on SQL/Temporal until SQL:99 was published • After the publication of SQL:99, neither US nor UK brought in any new proposals to resolve the differences • Because of inactivity, both ANSI and ISO decided to cancel SQL/Temporal part in 2001 4
  • 5. Temporal Features Second Attempt 2008 - 2011 • A second attempt at adding temporal features to the SQL standard was made in 2008. It started with the acceptance of a proposal on "system-versioned tables" by both INCITS DM32.2 and ISO/IEC JTC1 SC32 WG3. Rather than resurrecting SQL/Temporal, this proposal added the temporal extensions to SQL/Foundation. • Another temporal feature was added in 2010 in the form of "application-time period tables”. • Both system-versioned tables and application-time period tables are now part of the new version of the SQL standard (SQL:2011) which was approved and published in 2011. • The temporal features in SQL:2011 are largely inspired by the earlier proposals considered during the first attempt but with a substantially different syntax. 5
  • 6. Temporal Data  Temporal data is data which changes over time • A company’s credit rating changes over time • Referred to as valid time dimension, real world perspective or business perspective • SQL:2011 calls this application time • The value we have in a database for a company’s credit rating changes over time • This may be different than application time due to timing differences • This may have nothing to do with the application time perspective (for example corrections) • Referred to as transaction time dimension or database perspective • SQL:2011 calls this system time (or system versioning)  Most data is temporal • Most common dimensions are application time and system time (focus of temporal features of SQL:2011)  It is helpful to think of non-temporal data as a trivial case of temporal data • Non-temporal data would be data which does not change (in real life, in a system, or we do not store a history of changes in a database)  Bitemporal data is data which changes over 2 dimensions of time independently • SQL:2011 calls this application time with system versioning 6
  • 7. 4 Types of tables No Application Time History Application Time History No System Time History Non-temporal Application time period table System Time History System versioned table System versioned application time period table  Non-temporal tables • Conventional tables (without date/timestamp in PK) • Latest information, without any history  Application time period tables • History of how data changed from an application time perspective as we know it now  System versioned tables • History of how current data from a application time perspective changed in the system (database)  System versioned application time period tables • History, of how history from an application time perspective, changed in the system (database) 7
  • 8. Things to know about temporal features in SQL:2011  Row based versioning • In contrast to column based versioning • But can be use to implement column based versioning  State based storage • 2 timestamps for application time periods • 2 timestamps for system time periods • 4 timestamps for system versioned application time period tables  State based inputs • User provides application period start AND application period end • Users do NOT provide system period start or end • Insert, update, and delete events are converted to states (till high datetime)  Time periods use the Closed – Open convention • AKA inclusive – exclusive • Supports unambiguous comparisons with different precisions  The strengths of the temporal features in SQL:2011 are: • Ease of migration (not dependent on period data type) • Fits well with SQL semantics (no statement modifiers) • Lots of user control (can update application start/end directly) • Compatibility (existing queries work against system versioned tables) 8
  • 9. Primary Keys for 4 Types of Tables  Non-temporal storage • No date/timestamp in PK  Application time period table • 2 timestamps (Application Period Start & Application Period End) is not enough • Application time periods can not overlap for the same object  System versioned table • System time periods should not overlap for the same object (but this is not part of the PK) • 2 rows for the same object can not have the same system start (constraint) • Transaction time is defined by implementation (high level of precision) • Transaction times should be sequential  System versioned application time period table • Application time periods can overlap for the same object • System time periods can overlap for the same object • BOTH application time period AND system time period should NOT overlap for the same object 9
  • 10. Application time period tables • Table definition – Define columns for application period start and end (need to be a date/timestamp data types and not null) – New PERIOD clause specifies what columns implement an application time period and creates an implicit constraint that application time period start < application time period end (pick your period name) – New WITHOUT OVERLAPS keywords in PRIMARY KEY clause ensures that application time periods do not overlap – FOREIGN KEY clause extended to include referencing of period in parent table • Inserting – Normal syntax • Comply with constraints ( start and end not null, start < end, no overlaps) • Deletes – Delete rows with normal syntax • Constrain on application time period start and end as desired or not ! – Delete using FOR PORTION OF application time period FROM DATE XXXX/XX/XX TO DATE XXXX/XX/XX clause results in automatic “row splitting” • Updates – Update rows with normal syntax (including application time period start and end columns) • Comply with constraints (start and end not null, start < end, no overlaps) • Constrain on application time period start and end as desired or not ! – Update using FOR PORTION OF application time period FROM DATE XXXX/XX/XX TO DATE XXXX/XX/XX clause results in automatic “row splitting” • Can’t update application period start or end using this option • Select – Normal Syntax (application time period start and end can be used since they are explicit columns) 10
  • 11. Application time period tables – Delete row splitting - 4 types of existing time slices - • There can be multiple types of existing time slices for a delete range • No error if delete over a range where no values 11
  • 12. Application time period tables – Update row splitting - 4 types of existing time slices - • There can be multiple types of existing time slices for a update range • No error if update over a range where no values • An update can cause multiple contiguous time slices to have the same non PK data values (unpacked) 12
  • 13. System versioned tables • Table definition – Define columns for system time period start and end (need to be date/timestamp data type and not null) with new GENERATE ALWAYS AS ROW BEGIN/END clause – New PERIOD clause with SYSTEM_TIME period name specifies what columns are in the system time period (system time period start < system time period end does not need to be enforced) – New WITH SYSTEM VERSIONING clause implicitly adds system time period start to primary key – Constraints only apply to rows which are not logically deleted – Referential Integrity is not impacted • Inserting – Normal syntax but never specify system time period start or end columns as they are generated – New time slices of data have system time period start = insert transaction time and system period end = high date/time • Deletes – Normal syntax but a history of what data was deleted and when it was deleted is maintained automatically – Deleted time slices of data have system period end = delete transaction time (logically deleted) – Only rows which are not logically deleted can be deleted • Updates – Normal syntax but a history of what data was updated and when it was updated is maintained automatically – Updated time slices of data have system period end = update transaction time (logically deleted) – Only rows which are not logically deleted can be updated • Select – Normal syntax works as if non-temporal table (do not query logically deleted rows) – New as-of, between, and from clauses are available to query all rows in the table • Including logically deleted rows 13
  • 14. System versioned tables – Delete history - 1 type of existing time slice - Not logically deleted Delete range begin = Delete transaction time Delete range end = High date/timestamp Logically deleted • There is only 1 type of existing time slice for a delete range • There can only be 1 time slice of interest for an object (that is not logically deleted) 14
  • 15. System versioned tables – Update History - 1 type of existing time slices - Not logically deleted Delete range begin = Delete transaction time Delete range end = High date/timestamp Not logically Logically deleted deleted • There can only be 1 type of existing time slice for an update range • There can only be 1 time slice of interest for an object (that is not logically deleted) 15
  • 16. System versioned application time period tables • Table definition – Define columns for application time period start and end (need to be date/timestamp data types and not null) – Define columns for system time period start and end (need to be date/timestamp data types and not null) with new GENERATE ALWAYS AS ROW BEGIN/END clause – New PERIOD clause to specifies what columns are in the application time period – New PERIOD clause with SYSTEM_TIME keyword specifies what columns are in system time period – New WITHOUT OVERLAPS keyword in PRIMARY KEY clause ensures that application time periods do not overlap – New WITH SYSTEM VERSIONING clause implicitly adds system time period start to primary key – Constraints only apply to rows which are not logically deleted – FOREIGN KEY clause extended to include referencing of period in parent table • Inserting – Same as application time period tables but never specify system time period start or end columns as they are generated • Deletes – Same as application time period tables but a history of what was deleted and when it was deleted is maintained automatically (rows) – Only rows which are not logically deleted can be deleted • Updates – Same as application time period tables but a history of what was updated and when it was updated is maintained automatically (rows) – Only rows which are not logically deleted can be updated • Select – Same as application period tables – New as-of, between, and from clauses are available to query all rows in the table • Including logically deleted rows 16
  • 17. Bitemporal tables – Delete splitting & history - 4 types of existing application time slices - • Same as application time period table deletes except update existing time slices instead of delete because: • Only 1 type of existing row from system versioning perspective • Application time period table delete splitting results in inserts and deletes • System versioning does not do any splitting for inserts • System versioning changes deletes into updates 17
  • 18. Bitemporal tables – Update splitting & history - 4 types of existing application time slices - • Same as application time period table updates except additional insert of existing time slice because: • Only 1 type of existing row from system versioning perspective • Application time period table update row splitting results in inserts and updates • System versioning does not do any splitting for inserts • System versioning changes updates into an update AND an insert 18
  • 19. Summary & Conclusions • Significant new temporal features have been included in SQL:2011 • Temporal features represent a significant extension to the SQL language that will take time for people to utilize • Vendors are beginning to adopt these features • Methodology for how to utilize new temporal features of SQL will probably be a factor in utilization • Time will tell how much the SQL:2011 temporal extensions are utilized • Implications of temporal extensions on replication, partitioning, archiving etc are still being sorted 19
  • 20. Next Steps • Actual syntax • Examples, Examples and more examples • Advanced topics – Temporal predicates – Joining different types of temporal tables – Referential integrity implications – Schema migration implications • Where are vendors with compliance/adoption • How vendors CAN comply but also differentiate • How vendors ARE differentiating 20
  • 21. Resources  Search YouTube.com for “Case for Bitemporal Data”  http://www.youtube.com/playlist?list=PL4CB3C8161D2804E6  TemporalData.com  “Temporal Data” LinkedIn group  http://www.linkedin.com/groups?gid=3885228  http://stacresearch.com/btd  Functional and performance benchmarks 21
  • 22. THANK YOU! USA UK BitemporalData.com LLC BitemporalData Ltd 1330 Route 206 Suite 13493, 2nd floor Suite 318 145-157 St John Street Skillman, NJ 08558 London EC1V 4PY Tel: +1.201.332.5000 Tel: +44.20.3318.5919 22