SlideShare ist ein Scribd-Unternehmen logo
1 von 13
Downloaden Sie, um offline zu lesen
Temporal Data in PostgreSQL




Scott Bailey
The Evergreen State College
PostgreSQL Conference West 2009
http://scottrbailey.wordpress.com
Agenda
✗   Provided data types
✗   Extended data types
✗   Temporal Databases
✗   What is in store for PostgreSQL
✗   Tips, tricks and questions
Thinking About Time
✗   Temporal Quiz
      ✗   How many minutes in a day?
      ✗   How many seconds in a day?
      ✗   How long does it take the Earth to complete one
           rotation?
      ✗   Actually, what is a second?
      ✗   What number should be at the top of the clock?
✗   Extremely complicated!
Basic Data Types
✗   Timestamp &Timestamp with time zone
      ✗   Granularity 1 microsecond
      ✗   Can only subtract two timestamps and
           add/subtract with intervals.
      ✗   Timestamp with out time zone is default for
            compliance with SQL specification.
      ✗   Which should you use?
✗   Date
      ✗   Granularity 1 day
      ✗   Can add/subtract dates & integers
Basic Types Cont.
✗   Interval – a duration of time
       ✗   Granularity 1 microsecond
       ✗   Add/Subtract/Multiply/Divide
✗   Time / Time with time zone
       ✗   Granularity 1 microsecond
       ✗   Acts like both time and a (small) interval
       ✗   Timezone info is useless without date
✗   Depricated types
       ✗   abstime (Unix timestamp), reltime (limited
            interval), timespan (interval), tinterval
            (period)
Period Data Type
✗   Period – defines an anchored interval or timespan
      ✗   Often what we are modeling is not an instantaneous
           event but a period over which some state is true.
      ✗   Typically implemented as a start and end timestamp.
           Could be implemented with an anchor time and an
           interval.
      ✗   Theory has been around for a while.
      ✗   Current implementations – PgTemporal, Chronos
      ✗   Write down a period representing today.
      ✗   Can be open or closed intervals but are typically half-
           open.
      ✗   [ ] indicates endpoints are contained () not contained.
Period Data Type
✗   Why a half open interval?
✗   Period functions
      ✗   Positional
             ✗   before(), after(), adjacent(), overlaps(), overleft(), over-
                  right(), starts(), ends()
      ✗   Containment
             ✗   contains(), contained_by()
      ✗   Manipulation
             ✗   shift(), grow(), shrink()
      ✗   Set functions – periods are contiguous sets
             ✗   period_union(), period_intersect(), period_minus(),
                  period_exclude()
Period Issues
✗   When one end point is unknown
       ✗   Since – period(timestamp, NULL)
       ✗   Until – period(NULL, timestamp) not as common
       ✗   Hard to do much with infinity.
✗   Referential integrity
       ✗   Primary keys – exclusion, can't be two places at
            once.
       ✗   Foreign keys – containment, lifetime of child item
            must be contained by parent's lifetime.
Non-contiguous Time Sets
✗   Why would we need non-contiguous sets?
✗   Set functions for periods can be applied to
    arrays of periods!
✗   Now we can solve (pretty easily) in SQL what
    would have taken LOTS of procedural code.
✗   Period Arrays vs Non-Contiguous Sets
           Period Array




              NCS
Bitemporal Data
✗   “Temporal Database” vs temporal data
      ✗   Both Valid Time (VT) and Transaction Time (TT).
✗   Valid Time – A period for which a fact is true.
      ✗   Employee X was in position Y from A to B.
      ✗   Store not just the current fact but a historical record.
✗   Transaction Time – Records the time a row was
    inserted and superseded
      ✗   Provides time travel or temporal rollback.
      ✗   Very much like the MVCC approach in PostgreSQL.
      ✗   Logging transaction ids with timestamp would let us
           map xmin & xmax to times.
Current Implementations
✗   Lots of theory out there, very few actual
    implementations.
✗   Oracle – Currently the best implementation in a
    general purpose database.
      ✗   Workspace Manager – version enable tables
             ✗   Automatically renames table, adds versioning
                  metadata (VT), creates view w/ original table name,
                  and defines INSTEAD OF triggers for DML.
             ✗   Handles temporal constraints.
             ✗   Provides a period data type and a subset of the
                  functions provided in pgTemporal, Chronos.
             ✗   Great implementation but solves only a single problem
                  domain and does not allow you to reuse them.
The Future for PostgreSQL
✗   Version 8.5
      ✗   Temporal keys and constraints
      ✗   Changes to the type system
      ✗   Period data type either added to core or as a
           contrib module!
✗   Version 8.6?
      ✗   Full support for periods, NCS, table versioning and
           time travel!
      ✗   Hands down the most complete temporal
           implementation of ANY general purpose
           database.
Additional Resources
✗   TSQL2 Specification -
    http://www.cs.arizona.edu/~rts/tsql2.html

✗   Developing Time-Oriented Database
    Applications – Snodgrass
    http://www.cs.arizona.edu/~rts/tdbbook.pdf

✗   Temporal Data and the Relational Model – Date,
    Darwen, Lorentzos
    http://books.google.com/books?isbn=1558608559

✗   TimeDB – For Oracle and IBM Cloudscape
    http://www.timeconsult.com/Software/Software.html

✗   Oracle Workspace Manager -
    http://www.oracle.com/technology/products/database/workspace_manager/index.html

Weitere ähnliche Inhalte

Was ist angesagt?

Using LLVM to accelerate processing of data in Apache Arrow
Using LLVM to accelerate processing of data in Apache ArrowUsing LLVM to accelerate processing of data in Apache Arrow
Using LLVM to accelerate processing of data in Apache Arrow
DataWorks Summit
 
Time Series Analysis - 2 | Time Series in R | ARIMA Model Forecasting | Data ...
Time Series Analysis - 2 | Time Series in R | ARIMA Model Forecasting | Data ...Time Series Analysis - 2 | Time Series in R | ARIMA Model Forecasting | Data ...
Time Series Analysis - 2 | Time Series in R | ARIMA Model Forecasting | Data ...
Simplilearn
 
Introduction to Stream Processing
Introduction to Stream ProcessingIntroduction to Stream Processing
Introduction to Stream Processing
Guido Schmutz
 
Data Warehouse Architectures
Data Warehouse ArchitecturesData Warehouse Architectures
Data Warehouse Architectures
Theju Paul
 

Was ist angesagt? (20)

Bloom filter
Bloom filterBloom filter
Bloom filter
 
Designing and Implementing a Real-time Data Lake with Dynamically Changing Sc...
Designing and Implementing a Real-time Data Lake with Dynamically Changing Sc...Designing and Implementing a Real-time Data Lake with Dynamically Changing Sc...
Designing and Implementing a Real-time Data Lake with Dynamically Changing Sc...
 
Apache Arrow: In Theory, In Practice
Apache Arrow: In Theory, In PracticeApache Arrow: In Theory, In Practice
Apache Arrow: In Theory, In Practice
 
Statistics For Data Science | Statistics Using R Programming Language | Hypot...
Statistics For Data Science | Statistics Using R Programming Language | Hypot...Statistics For Data Science | Statistics Using R Programming Language | Hypot...
Statistics For Data Science | Statistics Using R Programming Language | Hypot...
 
L2. Evaluating Machine Learning Algorithms I
L2. Evaluating Machine Learning Algorithms IL2. Evaluating Machine Learning Algorithms I
L2. Evaluating Machine Learning Algorithms I
 
Using LLVM to accelerate processing of data in Apache Arrow
Using LLVM to accelerate processing of data in Apache ArrowUsing LLVM to accelerate processing of data in Apache Arrow
Using LLVM to accelerate processing of data in Apache Arrow
 
introduction to NOSQL Database
introduction to NOSQL Databaseintroduction to NOSQL Database
introduction to NOSQL Database
 
NoSQL databases
NoSQL databasesNoSQL databases
NoSQL databases
 
Time Series Analysis - 2 | Time Series in R | ARIMA Model Forecasting | Data ...
Time Series Analysis - 2 | Time Series in R | ARIMA Model Forecasting | Data ...Time Series Analysis - 2 | Time Series in R | ARIMA Model Forecasting | Data ...
Time Series Analysis - 2 | Time Series in R | ARIMA Model Forecasting | Data ...
 
pandas: Powerful data analysis tools for Python
pandas: Powerful data analysis tools for Pythonpandas: Powerful data analysis tools for Python
pandas: Powerful data analysis tools for Python
 
MongodB Internals
MongodB InternalsMongodB Internals
MongodB Internals
 
Apache HBase™
Apache HBase™Apache HBase™
Apache HBase™
 
Introduction to Stream Processing
Introduction to Stream ProcessingIntroduction to Stream Processing
Introduction to Stream Processing
 
9. Document Oriented Databases
9. Document Oriented Databases9. Document Oriented Databases
9. Document Oriented Databases
 
Spark - Alexis Seigneurin (Français)
Spark - Alexis Seigneurin (Français)Spark - Alexis Seigneurin (Français)
Spark - Alexis Seigneurin (Français)
 
Apache Spark - Basics of RDD | Big Data Hadoop Spark Tutorial | CloudxLab
Apache Spark - Basics of RDD | Big Data Hadoop Spark Tutorial | CloudxLabApache Spark - Basics of RDD | Big Data Hadoop Spark Tutorial | CloudxLab
Apache Spark - Basics of RDD | Big Data Hadoop Spark Tutorial | CloudxLab
 
Big data unit i
Big data unit iBig data unit i
Big data unit i
 
Scaling and Normalization
Scaling and NormalizationScaling and Normalization
Scaling and Normalization
 
Data Warehouse Architectures
Data Warehouse ArchitecturesData Warehouse Architectures
Data Warehouse Architectures
 
Data preprocessing using Machine Learning
Data  preprocessing using Machine Learning Data  preprocessing using Machine Learning
Data preprocessing using Machine Learning
 

Andere mochten auch

The study on mining temporal patterns and related applications in dynamic soc...
The study on mining temporal patterns and related applications in dynamic soc...The study on mining temporal patterns and related applications in dynamic soc...
The study on mining temporal patterns and related applications in dynamic soc...
Thanh Hieu
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
Command Prompt., Inc
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
Command Prompt., Inc
 
Transaction Timestamping in Temporal Databases
Transaction Timestamping in Temporal DatabasesTransaction Timestamping in Temporal Databases
Transaction Timestamping in Temporal Databases
Gera Shegalov
 

Andere mochten auch (20)

Temporal database
Temporal databaseTemporal database
Temporal database
 
Temporal Databases: Queries
Temporal Databases: QueriesTemporal Databases: Queries
Temporal Databases: Queries
 
Temporal Databases: Data Models
Temporal Databases: Data ModelsTemporal Databases: Data Models
Temporal Databases: Data Models
 
Temporal data mining
Temporal data miningTemporal data mining
Temporal data mining
 
An Overview of Temporal Features in SQL:2011
An Overview of Temporal Features in SQL:2011An Overview of Temporal Features in SQL:2011
An Overview of Temporal Features in SQL:2011
 
Comparision
ComparisionComparision
Comparision
 
The study on mining temporal patterns and related applications in dynamic soc...
The study on mining temporal patterns and related applications in dynamic soc...The study on mining temporal patterns and related applications in dynamic soc...
The study on mining temporal patterns and related applications in dynamic soc...
 
ORDBMS
ORDBMSORDBMS
ORDBMS
 
Theories and Applications of Spatial-Temporal Data Mining and Knowledge Disco...
Theories and Applications of Spatial-Temporal Data Mining and Knowledge Disco...Theories and Applications of Spatial-Temporal Data Mining and Knowledge Disco...
Theories and Applications of Spatial-Temporal Data Mining and Knowledge Disco...
 
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
PostgreSQL, Extensible to the Nth Degree: Functions, Languages, Types, Rules,...
 
Bucardo
BucardoBucardo
Bucardo
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
Basic Query Tuning Primer
Basic Query Tuning PrimerBasic Query Tuning Primer
Basic Query Tuning Primer
 
Not Just UNIQUE: Generalized Index Constraints
Not Just UNIQUE: Generalized Index ConstraintsNot Just UNIQUE: Generalized Index Constraints
Not Just UNIQUE: Generalized Index Constraints
 
The PostgreSQL Query Planner
The PostgreSQL Query PlannerThe PostgreSQL Query Planner
The PostgreSQL Query Planner
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
PostgreSQL High Availability via SLONY and PG POOL II
PostgreSQL High Availability via SLONY and PG POOL IIPostgreSQL High Availability via SLONY and PG POOL II
PostgreSQL High Availability via SLONY and PG POOL II
 
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
Building tungsten-clusters-with-postgre sql-hot-standby-and-streaming-replica...
 
Transaction Timestamping in Temporal Databases
Transaction Timestamping in Temporal DatabasesTransaction Timestamping in Temporal Databases
Transaction Timestamping in Temporal Databases
 
Chapter24
Chapter24Chapter24
Chapter24
 

Ähnlich wie Temporal Data

CS3114_09212011.ppt
CS3114_09212011.pptCS3114_09212011.ppt
CS3114_09212011.ppt
Arumugam90
 
Cassandra Data Modeling
Cassandra Data ModelingCassandra Data Modeling
Cassandra Data Modeling
Matthew Dennis
 
Cassandra NYC 2011 Data Modeling
Cassandra NYC 2011 Data ModelingCassandra NYC 2011 Data Modeling
Cassandra NYC 2011 Data Modeling
Matthew Dennis
 

Ähnlich wie Temporal Data (20)

A Brief History of Stream Processing
A Brief History of Stream ProcessingA Brief History of Stream Processing
A Brief History of Stream Processing
 
Cs 331 Data Structures
Cs 331 Data StructuresCs 331 Data Structures
Cs 331 Data Structures
 
Job Queues Overview
Job Queues OverviewJob Queues Overview
Job Queues Overview
 
Developer-friendly taskqueues: What you should ask yourself before choosing one
Developer-friendly taskqueues: What you should ask yourself before choosing oneDeveloper-friendly taskqueues: What you should ask yourself before choosing one
Developer-friendly taskqueues: What you should ask yourself before choosing one
 
Developer-friendly task queues: what we learned building MRQ, Sylvain Zimmer
Developer-friendly task queues: what we learned building MRQ, Sylvain ZimmerDeveloper-friendly task queues: what we learned building MRQ, Sylvain Zimmer
Developer-friendly task queues: what we learned building MRQ, Sylvain Zimmer
 
introduction to data processing using Hadoop and Pig
introduction to data processing using Hadoop and Pigintroduction to data processing using Hadoop and Pig
introduction to data processing using Hadoop and Pig
 
CS3114_09212011.ppt
CS3114_09212011.pptCS3114_09212011.ppt
CS3114_09212011.ppt
 
Cloud spanner architecture and use cases
Cloud spanner architecture and use casesCloud spanner architecture and use cases
Cloud spanner architecture and use cases
 
OpenTSDB: HBaseCon2017
OpenTSDB: HBaseCon2017OpenTSDB: HBaseCon2017
OpenTSDB: HBaseCon2017
 
Using Time Window Compaction Strategy For Time Series Workloads
Using Time Window Compaction Strategy For Time Series WorkloadsUsing Time Window Compaction Strategy For Time Series Workloads
Using Time Window Compaction Strategy For Time Series Workloads
 
Cassandra Data Modeling
Cassandra Data ModelingCassandra Data Modeling
Cassandra Data Modeling
 
Tracking your data across the fourth dimension
Tracking your data across the fourth dimensionTracking your data across the fourth dimension
Tracking your data across the fourth dimension
 
Cassandra NYC 2011 Data Modeling
Cassandra NYC 2011 Data ModelingCassandra NYC 2011 Data Modeling
Cassandra NYC 2011 Data Modeling
 
Accumulo14 15
Accumulo14 15Accumulo14 15
Accumulo14 15
 
Analyzing and Interpreting AWR
Analyzing and Interpreting AWRAnalyzing and Interpreting AWR
Analyzing and Interpreting AWR
 
"Working with date and time data in .NET", Jon Skeet
"Working with date and time data in .NET", Jon Skeet"Working with date and time data in .NET", Jon Skeet
"Working with date and time data in .NET", Jon Skeet
 
Re-Engineering PostgreSQL as a Time-Series Database
Re-Engineering PostgreSQL as a Time-Series DatabaseRe-Engineering PostgreSQL as a Time-Series Database
Re-Engineering PostgreSQL as a Time-Series Database
 
Leveraging spire for complex time allocation logic
Leveraging spire for complex time allocation logicLeveraging spire for complex time allocation logic
Leveraging spire for complex time allocation logic
 
Monitoring your Python with Prometheus (Python Ireland April 2015)
Monitoring your Python with Prometheus (Python Ireland April 2015)Monitoring your Python with Prometheus (Python Ireland April 2015)
Monitoring your Python with Prometheus (Python Ireland April 2015)
 
Data all over the place! How SQL and Apache Calcite bring sanity to streaming...
Data all over the place! How SQL and Apache Calcite bring sanity to streaming...Data all over the place! How SQL and Apache Calcite bring sanity to streaming...
Data all over the place! How SQL and Apache Calcite bring sanity to streaming...
 

Mehr von Command Prompt., Inc

Replication using PostgreSQL Replicator
Replication using PostgreSQL ReplicatorReplication using PostgreSQL Replicator
Replication using PostgreSQL Replicator
Command Prompt., Inc
 

Mehr von Command Prompt., Inc (20)

Howdah - An Application using Pylons, PostgreSQL, Simpycity and Exceptable
Howdah - An Application using Pylons, PostgreSQL, Simpycity and ExceptableHowdah - An Application using Pylons, PostgreSQL, Simpycity and Exceptable
Howdah - An Application using Pylons, PostgreSQL, Simpycity and Exceptable
 
Backup and-recovery2
Backup and-recovery2Backup and-recovery2
Backup and-recovery2
 
Replication using PostgreSQL Replicator
Replication using PostgreSQL ReplicatorReplication using PostgreSQL Replicator
Replication using PostgreSQL Replicator
 
Go replicator
Go replicatorGo replicator
Go replicator
 
Pg migrator
Pg migratorPg migrator
Pg migrator
 
Python utilities for data presentation
Python utilities for data presentationPython utilities for data presentation
Python utilities for data presentation
 
Implementing the Future of PostgreSQL Clustering with Tungsten
Implementing the Future of PostgreSQL Clustering with TungstenImplementing the Future of PostgreSQL Clustering with Tungsten
Implementing the Future of PostgreSQL Clustering with Tungsten
 
Elephant Roads: a tour of Postgres forks
Elephant Roads: a tour of Postgres forksElephant Roads: a tour of Postgres forks
Elephant Roads: a tour of Postgres forks
 
configuring a warm standby, the easy way
configuring a warm standby, the easy wayconfiguring a warm standby, the easy way
configuring a warm standby, the easy way
 
A Practical Multi-Tenant Cluster
A Practical Multi-Tenant ClusterA Practical Multi-Tenant Cluster
A Practical Multi-Tenant Cluster
 
5 Steps to PostgreSQL Performance
5 Steps to PostgreSQL Performance5 Steps to PostgreSQL Performance
5 Steps to PostgreSQL Performance
 
Normalization: A Workshop for Everybody Pt. 2
Normalization: A Workshop for Everybody Pt. 2Normalization: A Workshop for Everybody Pt. 2
Normalization: A Workshop for Everybody Pt. 2
 
Normalization: A Workshop for Everybody Pt. 1
Normalization: A Workshop for Everybody Pt. 1Normalization: A Workshop for Everybody Pt. 1
Normalization: A Workshop for Everybody Pt. 1
 
Integrating PostGIS in Web Applications
Integrating PostGIS in Web ApplicationsIntegrating PostGIS in Web Applications
Integrating PostGIS in Web Applications
 
Postgres for MySQL (and other database) people
Postgres for MySQL (and other database) peoplePostgres for MySQL (and other database) people
Postgres for MySQL (and other database) people
 
Building Grails applications with PostgreSQL
Building Grails applications with PostgreSQLBuilding Grails applications with PostgreSQL
Building Grails applications with PostgreSQL
 
Pg amqp
Pg amqpPg amqp
Pg amqp
 
Not Just UNIQUE: Exclusion Constraints
Not Just UNIQUE: Exclusion ConstraintsNot Just UNIQUE: Exclusion Constraints
Not Just UNIQUE: Exclusion Constraints
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
Database Hardware Benchmarking
Database Hardware BenchmarkingDatabase Hardware Benchmarking
Database Hardware Benchmarking
 

Temporal Data

  • 1. Temporal Data in PostgreSQL Scott Bailey The Evergreen State College PostgreSQL Conference West 2009 http://scottrbailey.wordpress.com
  • 2. Agenda ✗ Provided data types ✗ Extended data types ✗ Temporal Databases ✗ What is in store for PostgreSQL ✗ Tips, tricks and questions
  • 3. Thinking About Time ✗ Temporal Quiz ✗ How many minutes in a day? ✗ How many seconds in a day? ✗ How long does it take the Earth to complete one rotation? ✗ Actually, what is a second? ✗ What number should be at the top of the clock? ✗ Extremely complicated!
  • 4. Basic Data Types ✗ Timestamp &Timestamp with time zone ✗ Granularity 1 microsecond ✗ Can only subtract two timestamps and add/subtract with intervals. ✗ Timestamp with out time zone is default for compliance with SQL specification. ✗ Which should you use? ✗ Date ✗ Granularity 1 day ✗ Can add/subtract dates & integers
  • 5. Basic Types Cont. ✗ Interval – a duration of time ✗ Granularity 1 microsecond ✗ Add/Subtract/Multiply/Divide ✗ Time / Time with time zone ✗ Granularity 1 microsecond ✗ Acts like both time and a (small) interval ✗ Timezone info is useless without date ✗ Depricated types ✗ abstime (Unix timestamp), reltime (limited interval), timespan (interval), tinterval (period)
  • 6. Period Data Type ✗ Period – defines an anchored interval or timespan ✗ Often what we are modeling is not an instantaneous event but a period over which some state is true. ✗ Typically implemented as a start and end timestamp. Could be implemented with an anchor time and an interval. ✗ Theory has been around for a while. ✗ Current implementations – PgTemporal, Chronos ✗ Write down a period representing today. ✗ Can be open or closed intervals but are typically half- open. ✗ [ ] indicates endpoints are contained () not contained.
  • 7. Period Data Type ✗ Why a half open interval? ✗ Period functions ✗ Positional ✗ before(), after(), adjacent(), overlaps(), overleft(), over- right(), starts(), ends() ✗ Containment ✗ contains(), contained_by() ✗ Manipulation ✗ shift(), grow(), shrink() ✗ Set functions – periods are contiguous sets ✗ period_union(), period_intersect(), period_minus(), period_exclude()
  • 8. Period Issues ✗ When one end point is unknown ✗ Since – period(timestamp, NULL) ✗ Until – period(NULL, timestamp) not as common ✗ Hard to do much with infinity. ✗ Referential integrity ✗ Primary keys – exclusion, can't be two places at once. ✗ Foreign keys – containment, lifetime of child item must be contained by parent's lifetime.
  • 9. Non-contiguous Time Sets ✗ Why would we need non-contiguous sets? ✗ Set functions for periods can be applied to arrays of periods! ✗ Now we can solve (pretty easily) in SQL what would have taken LOTS of procedural code. ✗ Period Arrays vs Non-Contiguous Sets Period Array NCS
  • 10. Bitemporal Data ✗ “Temporal Database” vs temporal data ✗ Both Valid Time (VT) and Transaction Time (TT). ✗ Valid Time – A period for which a fact is true. ✗ Employee X was in position Y from A to B. ✗ Store not just the current fact but a historical record. ✗ Transaction Time – Records the time a row was inserted and superseded ✗ Provides time travel or temporal rollback. ✗ Very much like the MVCC approach in PostgreSQL. ✗ Logging transaction ids with timestamp would let us map xmin & xmax to times.
  • 11. Current Implementations ✗ Lots of theory out there, very few actual implementations. ✗ Oracle – Currently the best implementation in a general purpose database. ✗ Workspace Manager – version enable tables ✗ Automatically renames table, adds versioning metadata (VT), creates view w/ original table name, and defines INSTEAD OF triggers for DML. ✗ Handles temporal constraints. ✗ Provides a period data type and a subset of the functions provided in pgTemporal, Chronos. ✗ Great implementation but solves only a single problem domain and does not allow you to reuse them.
  • 12. The Future for PostgreSQL ✗ Version 8.5 ✗ Temporal keys and constraints ✗ Changes to the type system ✗ Period data type either added to core or as a contrib module! ✗ Version 8.6? ✗ Full support for periods, NCS, table versioning and time travel! ✗ Hands down the most complete temporal implementation of ANY general purpose database.
  • 13. Additional Resources ✗ TSQL2 Specification - http://www.cs.arizona.edu/~rts/tsql2.html ✗ Developing Time-Oriented Database Applications – Snodgrass http://www.cs.arizona.edu/~rts/tdbbook.pdf ✗ Temporal Data and the Relational Model – Date, Darwen, Lorentzos http://books.google.com/books?isbn=1558608559 ✗ TimeDB – For Oracle and IBM Cloudscape http://www.timeconsult.com/Software/Software.html ✗ Oracle Workspace Manager - http://www.oracle.com/technology/products/database/workspace_manager/index.html