Professional Documents
Culture Documents
Advanced Dbms ETCS-423: Case Study - 2
Advanced Dbms ETCS-423: Case Study - 2
ETCS-423
CASE STUDY - 2
Submitted to Submitted By
Ms. Sakshi Jindal Anmol Saxena
65311502716
1. INTRODUCTION
A temporal database stores data relating to time instances. It offers temporal data types and
stores information relating to past, present and future time. Temporal databases could be uni-
temporal, bi-temporal or tri-temporal. Assume we would like to store data about our employees
with respect to the real world. Then, the following table could result:
Emp ID Name Department Salary Valid Time Start Valid Time End
10 John Research 11000 1985 1990
10 John Sales 11000 1990 1993
10 John Sales 12000 1993 INF
11 Paul Research 10000 1988 1995
12 George Research 10500 1991 INF
13 Ringo Sales 15500 1988 INF
The above valid-time table stores the history of the employees with respect to the real world.
The attributes Valid Time Start and Valid Time End actually represent a time interval which
is closed at its lower and open at its upper bound. Thus, we see that during the time period
[1985 - 1990), employee John was working in the research department, having a salary of
11000. Then he changed to the sales department, still earning 11000. In 1993, he got a salary
raise to 12000. The upper bound INF denotes that the tuple is valid until further notice. Note
that it is now possible to store information about past states. We see that Paul was employed
from 1988 until 1995. In the corresponding non-temporal table, this information was
(physically) deleted when Paul left the company.
More specifically the temporal aspects usually include valid time, transaction time or decision
time
• Valid time is the time period during which a fact is true in the real world.
• Transaction time is the time period during which a fact stored in the database was known.
• Decision time is the time period during which a fact stored in the database was decided to
be valid.
As we mentioned above, commercial DBMS are said to store only a single state of the real
world, usually the most recent state. Such databases usually are called snapshot databases. A
snapshot database in the context of valid time and transaction time is depicted in the following
picture:
Fig. 1 represents valid time and transaction time
On the other hand, a bitemporal DBMS such as Time DB stores the history of data with respect
to both valid time and transaction time. Note that the history of when data was stored in the
database (transaction time) is limited to past and present database states, since it is managed by
the system directly which does not know anything about future states.
A table in the bitemporal relational DBMS Time DB may either be a snapshot table (storing
only current data), a valid-time table (storing when the data is valid wrt. the real world), a
transaction-time table (storing when the data was recorded in the database) or a bitemporal
table (storing both valid time and transaction time). An extended version of SQL allows to
specify which kind of table is needed when the table is created. Existing tables may also be
altered (schema versioning). Additionally, it supports temporal queries, temporal modification
statements and temporalconstraints.
The states stored in a bitemporal database are sketched in the picture below. Of course, a
temporal DBMS such as Time DB does not store each database state separately as depicted in
the picture below. It stores valid time and/or transaction time for each tuple, as described above.
Fig. 2 Represents valid and transaction time
2.1 Uni-Temporal
A uni-temporal database has one axis of time, either the validity range or the system time range.
2.2 Bi-Temporal
A bi-temporal database has two axis of time.
• valid time.
• transaction time or decision time.
2.3 Tri-Temporal
A tri-temporal database has three axes of time.
• valid time.
• transaction time
• decision time.
This approach introduces additional complexities.
Temporal databases are in contrast to current databases (not to be confused with currently
available databases), which store only facts which are believed to be true at the current time.
3. Features
Temporal databases support managing and accessing temporal data by providing one or more
of the following features:
• A time period datatype, including the ability to represent time periods with no end (infinity
or forever)
• The ability to define valid and transaction time period attributes and bitemporal relations
• System-maintained transaction time
• Temporal primary keys, including non-overlapping period constraints
• Temporal constraints, including non-overlapping uniqueness and referential integrity
• Update and deletion of temporal records with automatic splitting and coalescing of time
periods
• Temporal queries at current time, time points in the past or future, or over durations
• Predicates for querying time periods, often based on Allen’s interval relations
Valid Time Relations. Let us now see how the different types of temporal data-bases may be
represented in the relational model. First, suppose that we would like to include the history of
changes as they occur in the real world. Consider again the database in Figure 3, and let us
assume that, for this application, the granularity is day. Then, we could convert the two
relations EMPLOYEE and DEPARTMENT into valid time relations by adding the
attributes Vst (Valid Start Time) and Vet (Valid End Time), whose data type is DATE in order
to provide day granularity. This is shown in Figure 3, where the relations have been
renamed EMP_VT and DEPT_VT, respectively.
Consider how the EMP_VT relation differs from the nontemporal EMPLOYEE relation
(Figure 3). In EMP_VT, each tuple V represents a version of an employee’s
Fi