A temporal database is a database that preserves not just the current state but also the historical state of information as it changes over time. The subject of a database is called the domain of discourse. In a non-temporal relational database, if the current state of the domain of discourse is represented in a relation, R{...}, with a key of {d}, then a temporal version of that same domain can be represented by a relation with a key of {d,t}, where t is the “time dimension” – an attribute or attributes that record a point in time or interval of time associated with each tuple.
{d} is called the domain key - the key that identifies instances of things in the domain of discourse. It is also called a business key or natural key.
t is referred to as the valid time or effective time of the data.
In everyday applications we are often interested in the duration of time over which a piece of data is valid and therefore t is usually understood to represent an interval of time rather than an instant in time. Since DBMSs don't necessarily support the concept of a single data type representing an interval of time, t may actually consist of two timestamps (ts and te) representing the start and end points of each time interval.
non-temporal (current state)
d |
data |
foo |
104 |
bar |
115 |
temporal
d |
ts |
te |
data |
foo |
2011-01-01 |
2011-03-04 |
101 |
foo |
2011-03-04 |
2011-04-10 |
104 |
bar |
2011-01-01 |
2011-02-28 |
110 |
bar |
2011-02-28 |
2011-04-10 |
115 |