How would you model a database management system that maintains record of the changes that occur on its objects?
model employee data
keep track of each employee's rank and salary
How would you do that?
Historical Database Management System
Provides timing information
Automatically maintains history
Allows for time-related queries
An extension to SQL
Adds clauses and operations on the time domain
Adds facilities for retrospective updates and time-rollback
Designer needs to specify time granularity
A state prevails over an interval of time, during which none of the attributes change their values
Designer needs to consider rate at which attributes change ("time normalization")
CREATE STATE TABLE Employee (
ENo CHAR(10) NOT NULL, /* Employee Number */
Proj CHAR(10), /* Project */
Sal DECIMAL(5) /* Salary */
UNIQUE(ENo))
WITH TIME GRANULARITY DATE;
HDBMS will add 2 more attributes "From" and "To" whose values define a nonnull interval of time
Employee will actually be stored as 2 segments defined by the schemes:
CurrentEmp (ENo, Proj, Sal, From, To)
HistoryEmp (ENo, Proj, Sal, From, To)
Event type relations don't have this segmentation
At time t1, insert
<"Smith", "Lotus", 30000>
Instant comparisons: <, >, =, <=, >=, !=
i1 CONTAINS i2: if all instants of i2 are also contained in i1
i1 MEETS i2: when i1 is t1..t2 and i2 is t2+1..t3
i1 ADJACENT i2: (i1 MEETS i2) OR (i2 MEETS i1)
i1 PRECEDES i2: when i1 is t1..t2 and i2 is t3..t4 and t2 < t3
Interval comparisons (t is instant and i is interval):
"+": concatenate two overlapping or consecutive intervals
"*": extract common part of two overlapping intervals