SlideShare une entreprise Scribd logo
1  sur  34
Télécharger pour lire hors ligne
Time Travelling with DB2 10
         for z/OS




    The Information Management Specialists
Topics
•   Introduction
•   DB2 10 for z/OS Overview
•   Temporal Data Support
•   Early Experiences
•   Further Reading
•   Summary

               The Information Management Specialists
Introduction
• Director and Principal Consultant at Triton Consulting
• 24 years DB2 experience, 19 as a consultant working with
  customers in UK, Europe and the US
• IBM Gold Consultant since 1999
• IBM Information Champion
• Former IDUG (International DB2 User Group) President
• Author of IBM Redbooks, white papers and more recently
  “flashbooks”


                  The Information Management Specialists
Topics
•   Introduction
•   DB2 10 for z/OS Overview
•   Temporal Data Support
•   Early Experiences
•   Further Reading
•   Summary

               The Information Management Specialists
DB2 10 for z/OS
• Extensive beta program running throughout
  2009/10, with customers from all around the world
• Generally available since October 2010
• Upgrade path provided from DB2 8 or DB2 9
• Many customers are currently planning their DB2 10
  upgrades, to begin in the next 12-24 months
    DB2 8 for z/OS End of Support in April 2012


                 The Information Management Specialists
Top New Features
•   CPU/Performance Improvements      •   In-memory object support
•   Temporal Data                     •   Optimiser enhancements
•   Virtual Storage Enhancements      •   MEMBER CLUSTER for UTS
•   High performance DBATs            •   Backup and recovery
•   Security Extensions                   enhancements
•   Improved Catalog Concurrency      •   Enhanced audit
•   Access Path Management            •   Include additional index
                                          columns
•   pureXML enhancements
•   Currently Committed semantics
                                      •   Enhanced SQL OLAP functions
•   Automated statistics
                                      •   Skip Migration
•   Dynamic schema change
    enhancements                      • And many more….

                    The Information Management Specialists
Topics
•   Introduction
•   DB2 10 for z/OS Overview
•   Temporal Data Support
•   Early Experiences
•   Further Reading
•   Summary

               The Information Management Specialists
Why Temporal Data?
• Most IT systems need to keep historical as well as current
  information
• Industry regulations and competitive pressures are
  prompting IT managers to maintain even more data for
  longer periods of time
• Most warehousing / analytics applications require a
  historical perspective of data
• Implementation requires lots of effort by DBA and
  developer to design, test and implement
    Lots of “reinventing the wheel”


                   The Information Management Specialists
Why Temporal Data?
• DB2 10 provides this functionality as part of the database
  engine – the first major RDBMS vendor to do so
    Improve DBAs and developer productivity
    Reduce errors in application code
    Reduce time-to-market for new applications
    Improve performance by driving function into the database
     engine
    Improve application consistency
    Support compliance / audit requirements


                  The Information Management Specialists
Why Temporal Data?
• Solve common business problems
   Ensure that a customer only has one financial position at a
    given time
   Was an insured covered for a procedure on a specific date?
     ►   Was that information correct at the time the claim was processed?
   Establish prices for a catalog ahead of time, so that they
    are completed before the change needs to be made
   Answer a customer complaint about an old bill
   … and many, many more

                    The Information Management Specialists
Temporal Data Concepts
• Temporal Table - a table that supports “data
  versioning” to allow point-in-time queries to be
  executed
    Multiple versions of each row are kept by DB2 as they
     change over time
    Additional metadata is kept, recording the period in time
     when a given version of the row was valid
    Contrast to traditional non-temporal (aka “snapshot”)
     tables, where only the current version of a row is available
     unless developer/DBA have taken additional steps to
     support historical perspective

                  The Information Management Specialists
Temporal Data Concepts
• Period – the time during which a given version of a row
  is/was valid
    Period is defined by special start timestamp and end timestamp
     columns in the temporal table
    Note that in current DB2 implementation start timestamp is
     inclusive (>=), but end timestamp is not inclusive (<)
       ►   Feature request to provide ZPARM and make this a site decision

                         CustNo   …       Start_TS            End_TS
    Period #1
                        123       …   2011-05-01 11:03   2011-05-26 23:51
                        123       …   2011-05-26 23:51   9999-12-31 23:59
    Period #2


                      The Information Management Specialists
Temporal Data Concepts
• System Temporal Table – a temporal table that uses
  DB2 system-defined periods to record row history
    Associated with a DB2 system event (INSERT / UPDATE /
     DELETE) against table – all changes captured
    DB2 automatically sets start and end timestamp for a
     period
    History is maintained in a separate “history” table
    No gaps between periods – end timestamp of previous row
     version = start timestamp of new version
    Useful for audit/compliance requirements
    Typically implemented by DBA
                 The Information Management Specialists
Temporal Data Concepts
• Business Temporal Table – a temporal table that uses
  business-defined periods to record row history
      Aka “application temporal”
      Associated with a business event such as a change of address
      Useful for tracking business events over time
      History is maintained in the base table
      Application has control over start and end timestamp for a
       given period
        ►   Can have gaps between periods
    Typically implemented by developer and DBA


                       The Information Management Specialists
Temporal Data Concepts
• Bi-Temporal Table – a temporal table that supports
  both business and system time periods
    Best of both worlds – application-defined versioning with
     complete audit trail of system changes
    Two sets of start/end timestamps defined




                  The Information Management Specialists
Implementation Choices
• User-managed
    Only choice prior to DB2 10
    Typically implemented using triggers to catch “before” version of row
     during INSERT/UPDATE/DELETE
       ►   Need application logic to determine if a given series already exists (update old
           row + INSERT in same UOW) or not (INSERT only)
    Lots of scope for inconsistency / errors in application code (e.g.
     overlapping periods)
       ►   Need audit function to ensure rows are valid, SQL can be horrible
    Lots of scope for performance issues – especially with index design
• DB2-managed
    Designed to avoid the pitfalls above
    Some potential performance gains – see later

                        The Information Management Specialists
Implementing DB2 Temporal Tables
• DBA indicates which tables need temporal support at CREATE/ALTER
  time
    Support for UTS, classic partitioned and single table segmented
     tablespaces
• For system temporal or bi-temporal tables
    DBA also creates separate history table with identical definition to
     base table (same columns, data types, null attributes, etc but no
     SYSTEM_TIME specification) and associates with base table via ALTER
    DB2 automatically copies old version of row to history table whenever
     row in main table is changed via DELETE or UPDATE
    DB2 automatically UNIONs base and history table as required



                    The Information Management Specialists
Select Extensions
• Elegant extensions to SELECT statement allow historical
  perspective to be seen via standard SQL
          Same syntax for SYSTEM_TIME and BUSINESS_TIME
                             SELECT     *
                             FROM       BASE_TABLE
                                        FOR SYSTEM_TIME AS OF :TSTAMP
                             WHERE      CUST_NO = 123

                                Single - Inclusive/Exclusive

SELECT      *                                         SELECT      *
FROM        BASE_TABLE                                FROM        BASE_TABLE
            FOR SYSTEM_TIME BETWEEN :ST_TSTAMP                    FOR SYSTEM_TIME FROM : ST_TSTAMP
                                  AND :EN_TSTAMP                                        TO : EN_TSTAMP
WHERE       CUST_NO = 123                             WHERE       CUST_NO = 123

         Multiple - Inclusive/Inclusive                        Multiple - Inclusive/Exclusive

                             The Information Management Specialists
Implementing System Temporal
• SYSTEM_TIME row begin column
       TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS ROW BEGIN
       Composed of 9-digit timestamp, plus 3 digits for data sharing member
       DB2 ensures uniqueness of generated values across transactions
       Not updateable by application
• SYSTEM_TIME row end column
     TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS ROW END
     Not updateable by application
• Data types for both begin and end columns must be the same
• INSERT, UPDATE, DELETE use standard syntax, all versioning handled by
  DB2
• Query rewrite for SELECT statements to UNION ALL history table


                        The Information Management Specialists
System Temporal DDL
CREATE TABLE CUSTOMER
(
CUST_NO            INTEGER NOT NULL,
…
SYS_START          TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS ROW BEGIN,
SYS_END            TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS ROW END,
SYS_CRT            TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS TRANSACTION START ID,
PERIOD SYSTEM_TIME(SYS_START, SYS_END)
);

CREATE TABLE CUSTOMER_HIST
(
CUST_NO            INTEGER NOT NULL,
…
SYS_START          TIMESTAMP(12) NOT NULL,
SYS_END            TIMESTAMP(12) NOT NULL
);

ALTER TABLE CUSTOMER ADD VERSIONING USE HISTORY TABLE CUSTOMER_HIST;

                       The Information Management Specialists
Example – System Temporal
    System           INSERT INTO EMP                                                      UPDATE EMP
     Event           VALUES (321, 20000)                                                  WHERE EMPNO = 321
                                                                                          SET SALARY = 25000



                              T1                T2              Time                             T3



         EmpNo       Salary        Start_TS     End_TS                   EmpNo   Salary       Start_TS         End_TS
Main         300     10000           T0        31-12-9999                 300    10000           T0        31-12-9999
Table
             321     20000           T1        31-12-9999                 321    25000           T3        31-12-9999


                   SELECT SALARY                                         EmpNo   Salary       Start_TS         End_TS
                   FROM EMP                = 25000
                   WHERE EMPNO = 321                                      321    20000           T1              T3


                                          SELECT SALARY
                                          FROM EMP                                                    History Table
                                           FOR SYSTEM TIME AS OF T2   = 20000
                                          WHERE EMPNO = 321

                                      The Information Management Specialists
Implementing Business Temporal
• BUSINESS_TIME row begin and row end columns can be defined as either:
     TIMESTAMP(6) NOT NULL
     DATE NOT NULL
• BUSINESS_TIME periods have a check constraint in which end > begin
  column
• New optional unique BUSINESS_TIME WITHOUT OVERLAPS index is useful
  in having a built-in mechanism for enforcing keys being unique over a
  period of time
     Adds start and end columns to index
• UPDATE and DELETE statements have been enhanced to allow updating
  and deleting based upon a period of time
     FOR PORTION OF BUSINESS_TIME FROM expression1 TO expression2



                      The Information Management Specialists
FOR PORTION OF…
                               UPDATE                 DELETE
Rows Contained
 FOR PORTION OF
 Business Time Row
 Result

Span FROM or TO
 FOR PORTION OF
 Business Time Row
 Result

Span FROM and TO
 FOR PORTION OF
 Business Time Row
 Result

                     The Information Management Specialists
Business Temporal DDL
CREATE TABLE CUSTOMER
(
CUST_NO            INTEGER NOT NULL,
…
BUS_START          TIMESTAMP(6) NOT NULL GENERATED ALWAYS AS ROW BEGIN,
BUS_END            TIMESTAMP(6) NOT NULL GENERATED ALWAYS AS ROW END,
PERIOD BUSINESS_TIME(BUS_START, BUS_END)
);

CREATE UNIQUE INDEX CUST_IX
ON CUSTOMER
(
CUST_NO,
BUSINESS_TIME WITHOUT OVERLAPS
);




                      The Information Management Specialists
Topics
•   Introduction
•   DB2 10 for z/OS Overview
•   Temporal Data Support
•   Performance
•   Early Experiences
•   Further Reading
•   Summary

               The Information Management Specialists
Performance – System Temporal
• Redbook measurement
• Transaction mix of 70% read
  (SELECT), 30% write (10% INSERT
  + 20% UPDATE/DELETE)
• Compare:
    Baseline (no history)
    History with triggers
    History with system temporal
• Result: 56% less CPU overhead
  using system temporal when
  compared to triggers
                                            Source: DB2 10 Performance Topics Redbook



                   The Information Management Specialists
Performance – System Temporal
• Redbook measurement
• Compare, for varying number of
  rows
    UPDATE/DELETE with triggers
    UPDATE/DELETE with system
     temporal
• Result
    30-39% less CPU overhead using
     system temporal for UPDATE
     when compared to triggers
    10-19% less CPU for DELETE
                                            Source: DB2 10 Performance Topics Redbook



                   The Information Management Specialists
Performance – Business Temporal
• Redbook measurement
• Compare performance of UPDATE
  which results in two or three rows
  being split
     UPDATE with business temporal
     INSERT/UPDATE via stored procedure




                                               Source: DB2 10 Performance Topics Redbook



                      The Information Management Specialists
Experiences – System Temporal
• System temporal is not a watertight audit strategy
     Can ALTER TABLE to remove history relationship if you have the necessary
      authority (no record in SYSCOPY if versioning added or dropped)
• Schema change is painful (e.g. adding a column)
     Need to prevent access, drop versioning, add column to both tables, add
      versioning again
     PM31313 addresses this – new function to support ALTER ADD COLUMN and
      keep history table in step
• Need to integrate with archival strategy (if you have one…)
• Need to treat base and history table as if they are referentially connected
  – backup and recover as a set
• Need to be able to supress history data from being replicated – open PMR
  (PM31315)


                       The Information Management Specialists
Experiences – Business Temporal /
General
• Some applications with user-managed temporal functionality
  can be ported relatively easily
    As long as DB2 implementation is consistent with your site/application
     approach
    DSNZPARM to set inclusive/inclusive or inclusive/exclusive is a
     common request
    Benefits must be clear
• Non-temporal UPDATE/DELETE still allowed – care is required
• Limited 3rd party support for SQL extensions

                    The Information Management Specialists
Topics
•   Introduction
•   DB2 10 for z/OS Overview
•   Temporal Data Support
•   Performance
•   Early Experiences
•   Further Reading
•   Summary

               The Information Management Specialists
Further Reading
• IBM DB2 10 Home Page
     http://www-01.ibm.com/software/data/db2/zos/db2-10/
• White Paper – DB2 10: A Smarter Database for a Smarter Planet
     https://www14.software.ibm.com/webapp/iwm/web/signup.do?source=sw-
      infomgt&S_PKG=wp-z-db2-smarter
     Also available as part of a “flashbook” - ISBN: 1583473610
• DB2 10 for z/OS Performance Topics Redbook (SG24-7942)
• IDUG – International DB2 User Group
     http://www.idug.org/




                     The Information Management Specialists
Topics
•   Introduction
•   DB2 10 for z/OS Overview
•   Temporal Data Support
•   Further Reading
•   Summary


               The Information Management Specialists
Summary
• DB2 10 contains a long list of significant enhancements to improve
  performance, scalability and productivity
• Temporal support is an industry first, and offers some compelling
  advantages for new applications than need a historical data
  perspective
      Improve DBAs and developer productivity
      Reduce errors in application code
      Reduce time-to-market for new applications
      Improve performance by driving function into the database engine
      Improve application consistency
      Support compliance / audit requirements


                     The Information Management Specialists

Contenu connexe

Tendances

DB2 10 & 11 for z/OS System Performance Monitoring and Optimisation
DB2 10 & 11 for z/OS System Performance Monitoring and OptimisationDB2 10 & 11 for z/OS System Performance Monitoring and Optimisation
DB2 10 & 11 for z/OS System Performance Monitoring and OptimisationJohn Campbell
 
IBM DB2 for z/OS Administration Basics
IBM DB2 for z/OS Administration BasicsIBM DB2 for z/OS Administration Basics
IBM DB2 for z/OS Administration BasicsIBM
 
SQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database PerformanceSQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database PerformanceMark Ginnebaugh
 
Five Tuning Tips For Your Datawarehouse
Five Tuning Tips For Your DatawarehouseFive Tuning Tips For Your Datawarehouse
Five Tuning Tips For Your DatawarehouseJeff Moss
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuningngupt28
 
Database Performance Tuning Introduction
Database  Performance Tuning IntroductionDatabase  Performance Tuning Introduction
Database Performance Tuning IntroductionMyOnlineITCourses
 
SQL Server Query Tuning Tips - Get it Right the First Time
SQL Server Query Tuning Tips - Get it Right the First TimeSQL Server Query Tuning Tips - Get it Right the First Time
SQL Server Query Tuning Tips - Get it Right the First TimeDean Richards
 
Larry Ellison Introduces Oracle Database In-Memory
Larry Ellison Introduces Oracle Database In-MemoryLarry Ellison Introduces Oracle Database In-Memory
Larry Ellison Introduces Oracle Database In-MemoryOracleCorporate
 
DB2 9 for z/OS - Business Value
DB2 9 for z/OS  - Business  ValueDB2 9 for z/OS  - Business  Value
DB2 9 for z/OS - Business ValueSurekha Parekh
 
Analyzing OTM Logs and Troubleshooting
Analyzing OTM Logs and TroubleshootingAnalyzing OTM Logs and Troubleshooting
Analyzing OTM Logs and TroubleshootingMavenWire
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuningSimon Huang
 
Cassandra Data Migration
Cassandra Data MigrationCassandra Data Migration
Cassandra Data MigrationBiagio Onorato
 
Oracle 12c New Features_RMAN_slides
Oracle 12c New Features_RMAN_slidesOracle 12c New Features_RMAN_slides
Oracle 12c New Features_RMAN_slidesSaiful
 
The Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cThe Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cDavid Yahalom
 
Survey On Temporal Data And Change Management in Data Warehouses
Survey On Temporal Data And Change Management in Data WarehousesSurvey On Temporal Data And Change Management in Data Warehouses
Survey On Temporal Data And Change Management in Data WarehousesEtisalat
 
Oracle Database Backups and Disaster Recovery @ Autodesk
Oracle Database Backups and Disaster Recovery @ AutodeskOracle Database Backups and Disaster Recovery @ Autodesk
Oracle Database Backups and Disaster Recovery @ AutodeskAlan Williams
 

Tendances (19)

Rmanpres
RmanpresRmanpres
Rmanpres
 
DB2 10 & 11 for z/OS System Performance Monitoring and Optimisation
DB2 10 & 11 for z/OS System Performance Monitoring and OptimisationDB2 10 & 11 for z/OS System Performance Monitoring and Optimisation
DB2 10 & 11 for z/OS System Performance Monitoring and Optimisation
 
IBM DB2 for z/OS Administration Basics
IBM DB2 for z/OS Administration BasicsIBM DB2 for z/OS Administration Basics
IBM DB2 for z/OS Administration Basics
 
SQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database PerformanceSQL Server Tuning to Improve Database Performance
SQL Server Tuning to Improve Database Performance
 
Five Tuning Tips For Your Datawarehouse
Five Tuning Tips For Your DatawarehouseFive Tuning Tips For Your Datawarehouse
Five Tuning Tips For Your Datawarehouse
 
Sql server performance tuning
Sql server performance tuningSql server performance tuning
Sql server performance tuning
 
Database Performance Tuning Introduction
Database  Performance Tuning IntroductionDatabase  Performance Tuning Introduction
Database Performance Tuning Introduction
 
SQL Server Query Tuning Tips - Get it Right the First Time
SQL Server Query Tuning Tips - Get it Right the First TimeSQL Server Query Tuning Tips - Get it Right the First Time
SQL Server Query Tuning Tips - Get it Right the First Time
 
Larry Ellison Introduces Oracle Database In-Memory
Larry Ellison Introduces Oracle Database In-MemoryLarry Ellison Introduces Oracle Database In-Memory
Larry Ellison Introduces Oracle Database In-Memory
 
DB2 9 for z/OS - Business Value
DB2 9 for z/OS  - Business  ValueDB2 9 for z/OS  - Business  Value
DB2 9 for z/OS - Business Value
 
Analyzing OTM Logs and Troubleshooting
Analyzing OTM Logs and TroubleshootingAnalyzing OTM Logs and Troubleshooting
Analyzing OTM Logs and Troubleshooting
 
Oracle db performance tuning
Oracle db performance tuningOracle db performance tuning
Oracle db performance tuning
 
Cassandra Data Migration
Cassandra Data MigrationCassandra Data Migration
Cassandra Data Migration
 
Oracle 12c New Features_RMAN_slides
Oracle 12c New Features_RMAN_slidesOracle 12c New Features_RMAN_slides
Oracle 12c New Features_RMAN_slides
 
The Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12cThe Top 12 Features new to Oracle 12c
The Top 12 Features new to Oracle 12c
 
Datastage Introduction To Data Warehousing
Datastage Introduction To Data Warehousing Datastage Introduction To Data Warehousing
Datastage Introduction To Data Warehousing
 
Survey On Temporal Data And Change Management in Data Warehouses
Survey On Temporal Data And Change Management in Data WarehousesSurvey On Temporal Data And Change Management in Data Warehouses
Survey On Temporal Data And Change Management in Data Warehouses
 
Oracle Database Backups and Disaster Recovery @ Autodesk
Oracle Database Backups and Disaster Recovery @ AutodeskOracle Database Backups and Disaster Recovery @ Autodesk
Oracle Database Backups and Disaster Recovery @ Autodesk
 
Memory Management
Memory ManagementMemory Management
Memory Management
 

En vedette

NHibernate for .NET
NHibernate for .NETNHibernate for .NET
NHibernate for .NETGuo Albert
 
.NET Core Blimey! (dotnetsheff Jan 2016)
.NET Core Blimey! (dotnetsheff Jan 2016).NET Core Blimey! (dotnetsheff Jan 2016)
.NET Core Blimey! (dotnetsheff Jan 2016)citizenmatt
 
DB2 Workload Manager Histograms
DB2 Workload Manager HistogramsDB2 Workload Manager Histograms
DB2 Workload Manager HistogramsKeith McDonald
 
What's New in Strobe? August 2016 Webcast
What's New in Strobe? August 2016 WebcastWhat's New in Strobe? August 2016 Webcast
What's New in Strobe? August 2016 WebcastCompuware
 
DBA Basics guide
DBA Basics guideDBA Basics guide
DBA Basics guideazoznasser1
 
Microservices with .Net - NDC Sydney, 2016
Microservices with .Net - NDC Sydney, 2016Microservices with .Net - NDC Sydney, 2016
Microservices with .Net - NDC Sydney, 2016Richard Banks
 
Big Data: Getting started with Big SQL self-study guide
Big Data:  Getting started with Big SQL self-study guideBig Data:  Getting started with Big SQL self-study guide
Big Data: Getting started with Big SQL self-study guideCynthia Saracco
 
Big Data: SQL on Hadoop from IBM
Big Data:  SQL on Hadoop from IBM Big Data:  SQL on Hadoop from IBM
Big Data: SQL on Hadoop from IBM Cynthia Saracco
 

En vedette (9)

NHibernate for .NET
NHibernate for .NETNHibernate for .NET
NHibernate for .NET
 
STROBE/STARDの解説
STROBE/STARDの解説STROBE/STARDの解説
STROBE/STARDの解説
 
.NET Core Blimey! (dotnetsheff Jan 2016)
.NET Core Blimey! (dotnetsheff Jan 2016).NET Core Blimey! (dotnetsheff Jan 2016)
.NET Core Blimey! (dotnetsheff Jan 2016)
 
DB2 Workload Manager Histograms
DB2 Workload Manager HistogramsDB2 Workload Manager Histograms
DB2 Workload Manager Histograms
 
What's New in Strobe? August 2016 Webcast
What's New in Strobe? August 2016 WebcastWhat's New in Strobe? August 2016 Webcast
What's New in Strobe? August 2016 Webcast
 
DBA Basics guide
DBA Basics guideDBA Basics guide
DBA Basics guide
 
Microservices with .Net - NDC Sydney, 2016
Microservices with .Net - NDC Sydney, 2016Microservices with .Net - NDC Sydney, 2016
Microservices with .Net - NDC Sydney, 2016
 
Big Data: Getting started with Big SQL self-study guide
Big Data:  Getting started with Big SQL self-study guideBig Data:  Getting started with Big SQL self-study guide
Big Data: Getting started with Big SQL self-study guide
 
Big Data: SQL on Hadoop from IBM
Big Data:  SQL on Hadoop from IBM Big Data:  SQL on Hadoop from IBM
Big Data: SQL on Hadoop from IBM
 

Similaire à Time Travelling With DB2 10 For zOS

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
 
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAA
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAATemporal Tables, Transparent Archiving in DB2 for z/OS and IDAA
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAACuneyt Goksu
 
Reduce planned database down time with Oracle technology
Reduce planned database down time with Oracle technologyReduce planned database down time with Oracle technology
Reduce planned database down time with Oracle technologyKirill Loifman
 
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
 
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
 
Reducing Your E-Business Suite Storage Footprint Using Oracle Advanced Compre...
Reducing Your E-Business Suite Storage Footprint Using Oracle Advanced Compre...Reducing Your E-Business Suite Storage Footprint Using Oracle Advanced Compre...
Reducing Your E-Business Suite Storage Footprint Using Oracle Advanced Compre...Andrejs Karpovs
 
Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502kaziul Islam Bulbul
 
Teradata Tutorial for Beginners
Teradata Tutorial for BeginnersTeradata Tutorial for Beginners
Teradata Tutorial for Beginnersrajkamaltibacademy
 
Sql server 2016 new features
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new featuresAjeet Singh
 
An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)Marco Gralike
 
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...Amazon Web Services
 
collab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdfcollab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdfElboulmaniMohamed
 
IMS05 IMS V14 8gb osam for haldb
IMS05   IMS V14 8gb osam for haldbIMS05   IMS V14 8gb osam for haldb
IMS05 IMS V14 8gb osam for haldbRobert Hain
 
Maaz Anjum - IOUG Collaborate 2013 - An Insight into Space Realization on ODA...
Maaz Anjum - IOUG Collaborate 2013 - An Insight into Space Realization on ODA...Maaz Anjum - IOUG Collaborate 2013 - An Insight into Space Realization on ODA...
Maaz Anjum - IOUG Collaborate 2013 - An Insight into Space Realization on ODA...Maaz Anjum
 
Implementing Tables and Views.pptx
Implementing Tables and Views.pptxImplementing Tables and Views.pptx
Implementing Tables and Views.pptxLuisManuelUrbinaAmad
 
IMS04 BMC Software Strategy and Roadmap
IMS04   BMC Software Strategy and RoadmapIMS04   BMC Software Strategy and Roadmap
IMS04 BMC Software Strategy and RoadmapRobert Hain
 

Similaire à Time Travelling With DB2 10 For zOS (20)

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
 
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAA
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAATemporal Tables, Transparent Archiving in DB2 for z/OS and IDAA
Temporal Tables, Transparent Archiving in DB2 for z/OS and IDAA
 
Reduce planned database down time with Oracle technology
Reduce planned database down time with Oracle technologyReduce planned database down time with Oracle technology
Reduce planned database down time with Oracle technology
 
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
 
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
 
Reducing Your E-Business Suite Storage Footprint Using Oracle Advanced Compre...
Reducing Your E-Business Suite Storage Footprint Using Oracle Advanced Compre...Reducing Your E-Business Suite Storage Footprint Using Oracle Advanced Compre...
Reducing Your E-Business Suite Storage Footprint Using Oracle Advanced Compre...
 
Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502Collaborate 2011-tuning-ebusiness-416502
Collaborate 2011-tuning-ebusiness-416502
 
Teradata Tutorial for Beginners
Teradata Tutorial for BeginnersTeradata Tutorial for Beginners
Teradata Tutorial for Beginners
 
Sql server 2016 new features
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new features
 
Sql server 2016 new features
Sql server 2016 new featuresSql server 2016 new features
Sql server 2016 new features
 
An AMIS overview of database 12c
An AMIS overview of database 12cAn AMIS overview of database 12c
An AMIS overview of database 12c
 
An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)
 
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...
AWS re:Invent 2016| DAT318 | Migrating from RDBMS to NoSQL: How Sony Moved fr...
 
collab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdfcollab2011-tuning-ebusiness-421966.pdf
collab2011-tuning-ebusiness-421966.pdf
 
IMS05 IMS V14 8gb osam for haldb
IMS05   IMS V14 8gb osam for haldbIMS05   IMS V14 8gb osam for haldb
IMS05 IMS V14 8gb osam for haldb
 
Chapter 11new
Chapter 11newChapter 11new
Chapter 11new
 
Maaz Anjum - IOUG Collaborate 2013 - An Insight into Space Realization on ODA...
Maaz Anjum - IOUG Collaborate 2013 - An Insight into Space Realization on ODA...Maaz Anjum - IOUG Collaborate 2013 - An Insight into Space Realization on ODA...
Maaz Anjum - IOUG Collaborate 2013 - An Insight into Space Realization on ODA...
 
Implementing Tables and Views.pptx
Implementing Tables and Views.pptxImplementing Tables and Views.pptx
Implementing Tables and Views.pptx
 
IMS04 BMC Software Strategy and Roadmap
IMS04   BMC Software Strategy and RoadmapIMS04   BMC Software Strategy and Roadmap
IMS04 BMC Software Strategy and Roadmap
 

Plus de Laura Hood

Top 10 DB2 Support Nightmares #10
Top 10 DB2 Support Nightmares  #10Top 10 DB2 Support Nightmares  #10
Top 10 DB2 Support Nightmares #10Laura Hood
 
Top 10 DB2 Support Nightmares #9
Top 10 DB2 Support Nightmares  #9Top 10 DB2 Support Nightmares  #9
Top 10 DB2 Support Nightmares #9Laura Hood
 
Top 10 DB2 Support Nightmares #8
Top 10 DB2 Support Nightmares  #8Top 10 DB2 Support Nightmares  #8
Top 10 DB2 Support Nightmares #8Laura Hood
 
Top 10 DB2 Support Nightmares #7
Top 10 DB2 Support Nightmares  #7 Top 10 DB2 Support Nightmares  #7
Top 10 DB2 Support Nightmares #7 Laura Hood
 
Top 10 db2 support nightmares #6
Top 10 db2 support nightmares #6Top 10 db2 support nightmares #6
Top 10 db2 support nightmares #6Laura Hood
 
Consultancy on Demand - Infographic
Consultancy on Demand - InfographicConsultancy on Demand - Infographic
Consultancy on Demand - InfographicLaura Hood
 
A Time Traveller's Guide to DB2: Technology Themes for 2014 and Beyond
A Time Traveller's Guide to DB2: Technology Themes for 2014 and BeyondA Time Traveller's Guide to DB2: Technology Themes for 2014 and Beyond
A Time Traveller's Guide to DB2: Technology Themes for 2014 and BeyondLaura Hood
 
Top 10 DB2 Support Nightmares #1
Top 10 DB2 Support Nightmares  #1Top 10 DB2 Support Nightmares  #1
Top 10 DB2 Support Nightmares #1Laura Hood
 
Db2 10 memory management uk db2 user group june 2013 [read-only]
Db2 10 memory management   uk db2 user group june 2013 [read-only]Db2 10 memory management   uk db2 user group june 2013 [read-only]
Db2 10 memory management uk db2 user group june 2013 [read-only]Laura Hood
 
DB2 10 Security Enhancements
DB2 10 Security EnhancementsDB2 10 Security Enhancements
DB2 10 Security EnhancementsLaura Hood
 
DbB 10 Webcast #3 The Secrets Of Scalability
DbB 10 Webcast #3   The Secrets Of ScalabilityDbB 10 Webcast #3   The Secrets Of Scalability
DbB 10 Webcast #3 The Secrets Of ScalabilityLaura Hood
 
DB2 10 Webcast #2 - Justifying The Upgrade
DB2 10 Webcast #2  - Justifying The UpgradeDB2 10 Webcast #2  - Justifying The Upgrade
DB2 10 Webcast #2 - Justifying The UpgradeLaura Hood
 
DB2DART - DB2Night Show October 2011
DB2DART - DB2Night Show October 2011DB2DART - DB2Night Show October 2011
DB2DART - DB2Night Show October 2011Laura Hood
 
DB2 z/OS &amp; Java - What\'s New?
DB2 z/OS &amp; Java - What\'s New?DB2 z/OS &amp; Java - What\'s New?
DB2 z/OS &amp; Java - What\'s New?Laura Hood
 
Temporal And Other DB2 10 For Z Os Highlights
Temporal And Other DB2 10 For Z Os HighlightsTemporal And Other DB2 10 For Z Os Highlights
Temporal And Other DB2 10 For Z Os HighlightsLaura Hood
 
DB210 Smarter Database IBM Tech Forum 2011
DB210 Smarter Database   IBM Tech Forum 2011DB210 Smarter Database   IBM Tech Forum 2011
DB210 Smarter Database IBM Tech Forum 2011Laura Hood
 
UKGSE DB2 pureScale
UKGSE DB2 pureScaleUKGSE DB2 pureScale
UKGSE DB2 pureScaleLaura Hood
 
UKCMG DB2 pureScale
UKCMG DB2 pureScaleUKCMG DB2 pureScale
UKCMG DB2 pureScaleLaura Hood
 
Episode 4 DB2 pureScale Performance Webinar Oct 2010
Episode 4 DB2 pureScale Performance Webinar Oct 2010Episode 4 DB2 pureScale Performance Webinar Oct 2010
Episode 4 DB2 pureScale Performance Webinar Oct 2010Laura Hood
 
Episode 3 DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
Episode 3  DB2 pureScale Availability And Recovery [Read Only] [Compatibility...Episode 3  DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
Episode 3 DB2 pureScale Availability And Recovery [Read Only] [Compatibility...Laura Hood
 

Plus de Laura Hood (20)

Top 10 DB2 Support Nightmares #10
Top 10 DB2 Support Nightmares  #10Top 10 DB2 Support Nightmares  #10
Top 10 DB2 Support Nightmares #10
 
Top 10 DB2 Support Nightmares #9
Top 10 DB2 Support Nightmares  #9Top 10 DB2 Support Nightmares  #9
Top 10 DB2 Support Nightmares #9
 
Top 10 DB2 Support Nightmares #8
Top 10 DB2 Support Nightmares  #8Top 10 DB2 Support Nightmares  #8
Top 10 DB2 Support Nightmares #8
 
Top 10 DB2 Support Nightmares #7
Top 10 DB2 Support Nightmares  #7 Top 10 DB2 Support Nightmares  #7
Top 10 DB2 Support Nightmares #7
 
Top 10 db2 support nightmares #6
Top 10 db2 support nightmares #6Top 10 db2 support nightmares #6
Top 10 db2 support nightmares #6
 
Consultancy on Demand - Infographic
Consultancy on Demand - InfographicConsultancy on Demand - Infographic
Consultancy on Demand - Infographic
 
A Time Traveller's Guide to DB2: Technology Themes for 2014 and Beyond
A Time Traveller's Guide to DB2: Technology Themes for 2014 and BeyondA Time Traveller's Guide to DB2: Technology Themes for 2014 and Beyond
A Time Traveller's Guide to DB2: Technology Themes for 2014 and Beyond
 
Top 10 DB2 Support Nightmares #1
Top 10 DB2 Support Nightmares  #1Top 10 DB2 Support Nightmares  #1
Top 10 DB2 Support Nightmares #1
 
Db2 10 memory management uk db2 user group june 2013 [read-only]
Db2 10 memory management   uk db2 user group june 2013 [read-only]Db2 10 memory management   uk db2 user group june 2013 [read-only]
Db2 10 memory management uk db2 user group june 2013 [read-only]
 
DB2 10 Security Enhancements
DB2 10 Security EnhancementsDB2 10 Security Enhancements
DB2 10 Security Enhancements
 
DbB 10 Webcast #3 The Secrets Of Scalability
DbB 10 Webcast #3   The Secrets Of ScalabilityDbB 10 Webcast #3   The Secrets Of Scalability
DbB 10 Webcast #3 The Secrets Of Scalability
 
DB2 10 Webcast #2 - Justifying The Upgrade
DB2 10 Webcast #2  - Justifying The UpgradeDB2 10 Webcast #2  - Justifying The Upgrade
DB2 10 Webcast #2 - Justifying The Upgrade
 
DB2DART - DB2Night Show October 2011
DB2DART - DB2Night Show October 2011DB2DART - DB2Night Show October 2011
DB2DART - DB2Night Show October 2011
 
DB2 z/OS &amp; Java - What\'s New?
DB2 z/OS &amp; Java - What\'s New?DB2 z/OS &amp; Java - What\'s New?
DB2 z/OS &amp; Java - What\'s New?
 
Temporal And Other DB2 10 For Z Os Highlights
Temporal And Other DB2 10 For Z Os HighlightsTemporal And Other DB2 10 For Z Os Highlights
Temporal And Other DB2 10 For Z Os Highlights
 
DB210 Smarter Database IBM Tech Forum 2011
DB210 Smarter Database   IBM Tech Forum 2011DB210 Smarter Database   IBM Tech Forum 2011
DB210 Smarter Database IBM Tech Forum 2011
 
UKGSE DB2 pureScale
UKGSE DB2 pureScaleUKGSE DB2 pureScale
UKGSE DB2 pureScale
 
UKCMG DB2 pureScale
UKCMG DB2 pureScaleUKCMG DB2 pureScale
UKCMG DB2 pureScale
 
Episode 4 DB2 pureScale Performance Webinar Oct 2010
Episode 4 DB2 pureScale Performance Webinar Oct 2010Episode 4 DB2 pureScale Performance Webinar Oct 2010
Episode 4 DB2 pureScale Performance Webinar Oct 2010
 
Episode 3 DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
Episode 3  DB2 pureScale Availability And Recovery [Read Only] [Compatibility...Episode 3  DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
Episode 3 DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
 

Time Travelling With DB2 10 For zOS

  • 1. Time Travelling with DB2 10 for z/OS The Information Management Specialists
  • 2. Topics • Introduction • DB2 10 for z/OS Overview • Temporal Data Support • Early Experiences • Further Reading • Summary The Information Management Specialists
  • 3. Introduction • Director and Principal Consultant at Triton Consulting • 24 years DB2 experience, 19 as a consultant working with customers in UK, Europe and the US • IBM Gold Consultant since 1999 • IBM Information Champion • Former IDUG (International DB2 User Group) President • Author of IBM Redbooks, white papers and more recently “flashbooks” The Information Management Specialists
  • 4. Topics • Introduction • DB2 10 for z/OS Overview • Temporal Data Support • Early Experiences • Further Reading • Summary The Information Management Specialists
  • 5. DB2 10 for z/OS • Extensive beta program running throughout 2009/10, with customers from all around the world • Generally available since October 2010 • Upgrade path provided from DB2 8 or DB2 9 • Many customers are currently planning their DB2 10 upgrades, to begin in the next 12-24 months  DB2 8 for z/OS End of Support in April 2012 The Information Management Specialists
  • 6. Top New Features • CPU/Performance Improvements • In-memory object support • Temporal Data • Optimiser enhancements • Virtual Storage Enhancements • MEMBER CLUSTER for UTS • High performance DBATs • Backup and recovery • Security Extensions enhancements • Improved Catalog Concurrency • Enhanced audit • Access Path Management • Include additional index columns • pureXML enhancements • Currently Committed semantics • Enhanced SQL OLAP functions • Automated statistics • Skip Migration • Dynamic schema change enhancements • And many more…. The Information Management Specialists
  • 7. Topics • Introduction • DB2 10 for z/OS Overview • Temporal Data Support • Early Experiences • Further Reading • Summary The Information Management Specialists
  • 8. Why Temporal Data? • Most IT systems need to keep historical as well as current information • Industry regulations and competitive pressures are prompting IT managers to maintain even more data for longer periods of time • Most warehousing / analytics applications require a historical perspective of data • Implementation requires lots of effort by DBA and developer to design, test and implement  Lots of “reinventing the wheel” The Information Management Specialists
  • 9. Why Temporal Data? • DB2 10 provides this functionality as part of the database engine – the first major RDBMS vendor to do so  Improve DBAs and developer productivity  Reduce errors in application code  Reduce time-to-market for new applications  Improve performance by driving function into the database engine  Improve application consistency  Support compliance / audit requirements The Information Management Specialists
  • 10. Why Temporal Data? • Solve common business problems  Ensure that a customer only has one financial position at a given time  Was an insured covered for a procedure on a specific date? ► Was that information correct at the time the claim was processed?  Establish prices for a catalog ahead of time, so that they are completed before the change needs to be made  Answer a customer complaint about an old bill  … and many, many more The Information Management Specialists
  • 11. Temporal Data Concepts • Temporal Table - a table that supports “data versioning” to allow point-in-time queries to be executed  Multiple versions of each row are kept by DB2 as they change over time  Additional metadata is kept, recording the period in time when a given version of the row was valid  Contrast to traditional non-temporal (aka “snapshot”) tables, where only the current version of a row is available unless developer/DBA have taken additional steps to support historical perspective The Information Management Specialists
  • 12. Temporal Data Concepts • Period – the time during which a given version of a row is/was valid  Period is defined by special start timestamp and end timestamp columns in the temporal table  Note that in current DB2 implementation start timestamp is inclusive (>=), but end timestamp is not inclusive (<) ► Feature request to provide ZPARM and make this a site decision CustNo … Start_TS End_TS Period #1 123 … 2011-05-01 11:03 2011-05-26 23:51 123 … 2011-05-26 23:51 9999-12-31 23:59 Period #2 The Information Management Specialists
  • 13. Temporal Data Concepts • System Temporal Table – a temporal table that uses DB2 system-defined periods to record row history  Associated with a DB2 system event (INSERT / UPDATE / DELETE) against table – all changes captured  DB2 automatically sets start and end timestamp for a period  History is maintained in a separate “history” table  No gaps between periods – end timestamp of previous row version = start timestamp of new version  Useful for audit/compliance requirements  Typically implemented by DBA The Information Management Specialists
  • 14. Temporal Data Concepts • Business Temporal Table – a temporal table that uses business-defined periods to record row history  Aka “application temporal”  Associated with a business event such as a change of address  Useful for tracking business events over time  History is maintained in the base table  Application has control over start and end timestamp for a given period ► Can have gaps between periods  Typically implemented by developer and DBA The Information Management Specialists
  • 15. Temporal Data Concepts • Bi-Temporal Table – a temporal table that supports both business and system time periods  Best of both worlds – application-defined versioning with complete audit trail of system changes  Two sets of start/end timestamps defined The Information Management Specialists
  • 16. Implementation Choices • User-managed  Only choice prior to DB2 10  Typically implemented using triggers to catch “before” version of row during INSERT/UPDATE/DELETE ► Need application logic to determine if a given series already exists (update old row + INSERT in same UOW) or not (INSERT only)  Lots of scope for inconsistency / errors in application code (e.g. overlapping periods) ► Need audit function to ensure rows are valid, SQL can be horrible  Lots of scope for performance issues – especially with index design • DB2-managed  Designed to avoid the pitfalls above  Some potential performance gains – see later The Information Management Specialists
  • 17. Implementing DB2 Temporal Tables • DBA indicates which tables need temporal support at CREATE/ALTER time  Support for UTS, classic partitioned and single table segmented tablespaces • For system temporal or bi-temporal tables  DBA also creates separate history table with identical definition to base table (same columns, data types, null attributes, etc but no SYSTEM_TIME specification) and associates with base table via ALTER  DB2 automatically copies old version of row to history table whenever row in main table is changed via DELETE or UPDATE  DB2 automatically UNIONs base and history table as required The Information Management Specialists
  • 18. Select Extensions • Elegant extensions to SELECT statement allow historical perspective to be seen via standard SQL  Same syntax for SYSTEM_TIME and BUSINESS_TIME SELECT * FROM BASE_TABLE FOR SYSTEM_TIME AS OF :TSTAMP WHERE CUST_NO = 123 Single - Inclusive/Exclusive SELECT * SELECT * FROM BASE_TABLE FROM BASE_TABLE FOR SYSTEM_TIME BETWEEN :ST_TSTAMP FOR SYSTEM_TIME FROM : ST_TSTAMP AND :EN_TSTAMP TO : EN_TSTAMP WHERE CUST_NO = 123 WHERE CUST_NO = 123 Multiple - Inclusive/Inclusive Multiple - Inclusive/Exclusive The Information Management Specialists
  • 19. Implementing System Temporal • SYSTEM_TIME row begin column  TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS ROW BEGIN  Composed of 9-digit timestamp, plus 3 digits for data sharing member  DB2 ensures uniqueness of generated values across transactions  Not updateable by application • SYSTEM_TIME row end column  TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS ROW END  Not updateable by application • Data types for both begin and end columns must be the same • INSERT, UPDATE, DELETE use standard syntax, all versioning handled by DB2 • Query rewrite for SELECT statements to UNION ALL history table The Information Management Specialists
  • 20. System Temporal DDL CREATE TABLE CUSTOMER ( CUST_NO INTEGER NOT NULL, … SYS_START TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS ROW BEGIN, SYS_END TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS ROW END, SYS_CRT TIMESTAMP(12) NOT NULL GENERATED ALWAYS AS TRANSACTION START ID, PERIOD SYSTEM_TIME(SYS_START, SYS_END) ); CREATE TABLE CUSTOMER_HIST ( CUST_NO INTEGER NOT NULL, … SYS_START TIMESTAMP(12) NOT NULL, SYS_END TIMESTAMP(12) NOT NULL ); ALTER TABLE CUSTOMER ADD VERSIONING USE HISTORY TABLE CUSTOMER_HIST; The Information Management Specialists
  • 21. Example – System Temporal System INSERT INTO EMP UPDATE EMP Event VALUES (321, 20000) WHERE EMPNO = 321 SET SALARY = 25000 T1 T2 Time T3 EmpNo Salary Start_TS End_TS EmpNo Salary Start_TS End_TS Main 300 10000 T0 31-12-9999 300 10000 T0 31-12-9999 Table 321 20000 T1 31-12-9999 321 25000 T3 31-12-9999 SELECT SALARY EmpNo Salary Start_TS End_TS FROM EMP = 25000 WHERE EMPNO = 321 321 20000 T1 T3 SELECT SALARY FROM EMP History Table FOR SYSTEM TIME AS OF T2 = 20000 WHERE EMPNO = 321 The Information Management Specialists
  • 22. Implementing Business Temporal • BUSINESS_TIME row begin and row end columns can be defined as either:  TIMESTAMP(6) NOT NULL  DATE NOT NULL • BUSINESS_TIME periods have a check constraint in which end > begin column • New optional unique BUSINESS_TIME WITHOUT OVERLAPS index is useful in having a built-in mechanism for enforcing keys being unique over a period of time  Adds start and end columns to index • UPDATE and DELETE statements have been enhanced to allow updating and deleting based upon a period of time  FOR PORTION OF BUSINESS_TIME FROM expression1 TO expression2 The Information Management Specialists
  • 23. FOR PORTION OF… UPDATE DELETE Rows Contained FOR PORTION OF Business Time Row Result Span FROM or TO FOR PORTION OF Business Time Row Result Span FROM and TO FOR PORTION OF Business Time Row Result The Information Management Specialists
  • 24. Business Temporal DDL CREATE TABLE CUSTOMER ( CUST_NO INTEGER NOT NULL, … BUS_START TIMESTAMP(6) NOT NULL GENERATED ALWAYS AS ROW BEGIN, BUS_END TIMESTAMP(6) NOT NULL GENERATED ALWAYS AS ROW END, PERIOD BUSINESS_TIME(BUS_START, BUS_END) ); CREATE UNIQUE INDEX CUST_IX ON CUSTOMER ( CUST_NO, BUSINESS_TIME WITHOUT OVERLAPS ); The Information Management Specialists
  • 25. Topics • Introduction • DB2 10 for z/OS Overview • Temporal Data Support • Performance • Early Experiences • Further Reading • Summary The Information Management Specialists
  • 26. Performance – System Temporal • Redbook measurement • Transaction mix of 70% read (SELECT), 30% write (10% INSERT + 20% UPDATE/DELETE) • Compare:  Baseline (no history)  History with triggers  History with system temporal • Result: 56% less CPU overhead using system temporal when compared to triggers Source: DB2 10 Performance Topics Redbook The Information Management Specialists
  • 27. Performance – System Temporal • Redbook measurement • Compare, for varying number of rows  UPDATE/DELETE with triggers  UPDATE/DELETE with system temporal • Result  30-39% less CPU overhead using system temporal for UPDATE when compared to triggers  10-19% less CPU for DELETE Source: DB2 10 Performance Topics Redbook The Information Management Specialists
  • 28. Performance – Business Temporal • Redbook measurement • Compare performance of UPDATE which results in two or three rows being split  UPDATE with business temporal  INSERT/UPDATE via stored procedure Source: DB2 10 Performance Topics Redbook The Information Management Specialists
  • 29. Experiences – System Temporal • System temporal is not a watertight audit strategy  Can ALTER TABLE to remove history relationship if you have the necessary authority (no record in SYSCOPY if versioning added or dropped) • Schema change is painful (e.g. adding a column)  Need to prevent access, drop versioning, add column to both tables, add versioning again  PM31313 addresses this – new function to support ALTER ADD COLUMN and keep history table in step • Need to integrate with archival strategy (if you have one…) • Need to treat base and history table as if they are referentially connected – backup and recover as a set • Need to be able to supress history data from being replicated – open PMR (PM31315) The Information Management Specialists
  • 30. Experiences – Business Temporal / General • Some applications with user-managed temporal functionality can be ported relatively easily  As long as DB2 implementation is consistent with your site/application approach  DSNZPARM to set inclusive/inclusive or inclusive/exclusive is a common request  Benefits must be clear • Non-temporal UPDATE/DELETE still allowed – care is required • Limited 3rd party support for SQL extensions The Information Management Specialists
  • 31. Topics • Introduction • DB2 10 for z/OS Overview • Temporal Data Support • Performance • Early Experiences • Further Reading • Summary The Information Management Specialists
  • 32. Further Reading • IBM DB2 10 Home Page  http://www-01.ibm.com/software/data/db2/zos/db2-10/ • White Paper – DB2 10: A Smarter Database for a Smarter Planet  https://www14.software.ibm.com/webapp/iwm/web/signup.do?source=sw- infomgt&S_PKG=wp-z-db2-smarter  Also available as part of a “flashbook” - ISBN: 1583473610 • DB2 10 for z/OS Performance Topics Redbook (SG24-7942) • IDUG – International DB2 User Group  http://www.idug.org/ The Information Management Specialists
  • 33. Topics • Introduction • DB2 10 for z/OS Overview • Temporal Data Support • Further Reading • Summary The Information Management Specialists
  • 34. Summary • DB2 10 contains a long list of significant enhancements to improve performance, scalability and productivity • Temporal support is an industry first, and offers some compelling advantages for new applications than need a historical data perspective  Improve DBAs and developer productivity  Reduce errors in application code  Reduce time-to-market for new applications  Improve performance by driving function into the database engine  Improve application consistency  Support compliance / audit requirements The Information Management Specialists