You are on page 1of 5

CCT/00004/019 caleb osoro

CCT/00253/019 Gideon Musau


CCT/00030/019 Chahenza faraji
CCT/00104/019 David Wafula
CCT/00118/019 Felix Kimweli

TEMPORAL DATABASE
Temporal databases are specialized databases designed to handle data with temporal aspects,
meaning they can store and manage data that changes over time. Here are some key concepts
associated with temporal databases:
1. Valid Time: Valid time refers to the time period during which a fact is true in the real
world. It represents the period when data is valid or accurate. For example, if you have a
database of employee records and an employee's salary changes on January 1st, 2024,
the valid time for that salary change would be from January 1st, 2024, onwards.
2. Transaction Time: Transaction time refers to the time period during which a fact is
stored in the database. It represents the period when data is recorded or stored in the
database. Continuing with the previous example, if the salary change is recorded in the
database on January 5th, 2024, the transaction time for that record would be from
January 5th, 2024, onwards.
3. Timestamp: A timestamp is a value that represents a specific point in time. It can be
used to record when an event occurred or when data was entered into the database.
Timestamps are crucial for maintaining temporal aspects of data in temporal databases.
4. Calendar: In the context of temporal databases, a calendar refers to a system for
organizing and representing time, typically including dates, months, and years.
Calendars help in managing and querying temporal data effectively.
5. Time Order: Time order refers to the chronological order of events or data points based
on their associated timestamps. It ensures that data is stored and retrieved in the
correct temporal sequence, which is essential for maintaining data integrity and
consistency in temporal databases.
Database representation and reasoning with time
Database representation and reasoning with time involves various approaches to handle
temporal aspects of data within databases. Here are some common methods:

1. Snapshot Databases:

➢ In a snapshot database, data is stored as it exists at a particular point in time,


often referred to as a snapshot. Each snapshot represents a consistent state of
the database at a specific moment.
➢ Snapshots are useful for querying data at specific points in time, providing a view
of the database at that moment without considering changes that occurred
before or after the snapshot was taken.
➢ However, snapshot databases may not capture the full history of changes to the
data, making it challenging to analyze data trends over time.

2. Rollback Databases:

➢ Rollback databases maintain a record of changes made to the database and


support the ability to "rollback" or undo those changes.
➢ Whenever a change is made to the database, the previous state of the affected
data is preserved, allowing for reverting to earlier versions if needed.
➢ Rollback databases are useful for maintaining data consistency and integrity by
providing mechanisms to recover from errors or unwanted changes.

3. Historical Databases:

➢ Historical databases store a complete history of changes to the data over time,
capturing every modification, insertion, or deletion.
➢ Each version of the data is preserved along with timestamps or transaction
identifiers to indicate when the changes occurred.
➢ Historical databases enable comprehensive analysis of data evolution, allowing
users to track changes, analyze trends, and perform temporal queries with
precision.

4. Temporal Databases:

➢ Temporal databases integrate the temporal aspects of data directly into the
database management system (DBMS), providing native support for storing,
querying, and reasoning about temporal data.
➢ Temporal databases typically include features such as valid time, transaction
time, temporal querying capabilities, and temporal integrity constraints.
➢ These databases offer robust support for managing time-varying data, enabling
sophisticated temporal queries, temporal joins, and temporal aggregation
operations.
Incorporating time in Relational databases
Incorporating time in relational databases involves various techniques to record changes
to databases and manage temporal aspects of data. Here are two common approaches
along with tuple and attribute timestamping:

1. Recording Changes to Databases:

a. Archiving:
- Archiving involves moving outdated or historical data from the active database to an
archive or secondary storage.
- Archived data is typically retained for compliance, historical analysis, or backup
purposes.
- Archiving helps maintain the performance and efficiency of the active database by
reducing the volume of data stored in it.
- Archived data can be accessed when needed, but it is separate from the active
database and may require additional steps for retrieval.

b. Time-Slicing:
- Time-slicing involves partitioning the database into segments based on time intervals,
such as days, weeks, or months.
- Each segment contains data relevant to a specific time period, allowing for efficient
querying and analysis of historical data.
- Time-slicing enables temporal queries that retrieve data within a particular time range
or interval.
- Implementing time-slicing requires careful planning and indexing to ensure optimal
performance, especially for large datasets spanning extended time periods.

2. Tuple Timestamping and Attribute Timestamping:

a. Tuple Timestamping:
- Tuple timestamping involves assigning a timestamp to each tuple (row) in a relational
table to indicate when the tuple was last modified.
- The timestamp captures the time of insertion, update, or deletion of the tuple.
- Tuple timestamping enables tracking changes to individual records, facilitating
historical analysis and temporal querying.
- Timestamps can be implemented using a dedicated timestamp column in the table or
by including timestamp metadata alongside each tuple.

b. Attribute Timestamping:
- Attribute timestamping involves assigning timestamps to specific attributes (columns)
within a relational table to track changes to those attributes over time.
- This approach is particularly useful when certain attributes have different validities or
change at different rates compared to the rest of the tuple.
- Attribute timestamps provide fine-grained temporal information, allowing for precise
analysis of attribute-level changes and temporal querying.
- Attribute timestamps can be implemented using additional columns dedicated to
storing timestamps for each attribute or by incorporating timestamp metadata directly
into the attribute values.

You might also like