Open In App

Introduction To Temporal Database

Last Updated : 09 May, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Pre-requisites: Database 

A temporal database is a database that needs some aspect of time for the organization of information. In the temporal database, each tuple in relation is associated with time. It stores information about the states of the real world and time. The temporal database does store information about past states it only stores information about current states. Whenever the state of the database changes, the information in the database gets updated. In many fields, it is very necessary to store information about past states. For example, a stock database must store information about past stock prizes for analysis. Historical information can be stored manually in the schema.

There are various terminologies in the temporal database:

  • Valid Time: The valid time is a time in which the facts are true with respect to the real world.
  • Transaction Time: The transaction time of the database is the time at which the fact is currently present in the database.
  • Decision Time: Decision time in the temporal database is the time at which the decision is made about the fact.

Temporal databases use a relational database for support. But relational databases have some problems in temporal database, i.e. it does not provide support for complex operations. Query operations also provide poor support for performing temporal queries.

Applications of Temporal Databases 

Finance: It is used to maintain the stock price histories.

  1. It can be used in Factory Monitoring System for storing information about current and past readings of sensors in the factory.
  2. Healthcare: The histories of the patient need to be maintained for giving the right treatment.
  3. Banking: For maintaining the credit histories of the user.

Examples of Temporal Databases 

  1. An EMPLOYEE table consists of a  Department table that the employee is assigned to. If an employee is transferred to another department at some point in time, this can be tracked if the EMPLOYEE table is an application time-period table that assigns the appropriate time periods to each department he/she works for.

Temporal Relation

A temporal relation is defined as a relation in which each tuple in a table of the database is associated with time, the time can be either transaction time or valid time.

Types of Temporal Relation

There are mainly three types of temporal relations:

1. Uni-Temporal Relation: The relation which is associated with valid or transaction time is called Uni-Temporal relation. It is related to only one time.

2. Bi-Temporal Relation: The relation which is associated with both valid time and transaction time is called a Bi-Temporal relation. Valid time has two parts namely start time and end time, similar in the case of transaction time.

3. Tri-Temporal Relation: The relation which is associated with three aspects of time namely Valid time, Transaction time, and Decision time called as Tri-Temporal relation.

Features of Temporal Databases

  • The temporal database provides built-in support for the time dimension.
  • Temporal database stores data related to the time aspects.
  • A temporal database contains Historical data instead of current data.
  • It provides a uniform way to deal with historical data.

Challenges of Temporal Databases

  1. Data Storage: In temporal databases, each version of the data needs to be stored separately. As a result, storing the data in temporal databases requires more storage as compared to storing data in non-temporal databases.                                                                                      
  2. Schema Design: The temporal database schema must accommodate the time dimension. Creating such a schema is more difficult than creating a schema for non-temporal databases.                                                                                                                                          
  3. Query Processing: Processing the query in temporal databases is slower than processing the query in non-temporal databases due to the additional complexity of managing temporal data. 

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads