Database 2025-02-27

Characteristics and Design of Nontemporal, Unitemporal, and Bitemporal

Exploring the features, design examples, advantages, and disadvantages of different temporal data models.

Read in: ja
Characteristics and Design of Nontemporal, Unitemporal, and Bitemporal

In data models, there are several patterns based on how the time axis (such as history or validity periods) is managed.

  1. Nontemporal
  2. Unitemporal
  3. Bitemporal

Each differs in terms of "how finely and in what sense time information is managed."

This post explains the characteristics, design examples, advantages, and disadvantages of these data models.

1. Nontemporal Data Model

Characteristics

Design Example

Advantages

Disadvantages

2. Unitemporal Data Model

Characteristics

Pattern Examples

  1. Managing System Time (Transaction Time)

    • Manages "when this record was INSERTed and when it was DELETEd (or invalidated)" in the database.
    • Useful mainly for audit purposes or when referencing historical data in the DB.
  2. Managing Business Time (Validity Period)

    • Represents "when this record is valid from a business perspective."
    • Used in cases where business logic's "valid dates," such as prices, contract periods, or organizational restructuring periods, are important.

Design Example (Business Time Management)

Advantages

Disadvantages

3. Bitemporal Data Model

Characteristics

Design Example

Below is an example. In practice, types and constraints vary depending on the DB product and requirements, but the concept remains the same.

CREATE TABLE contract_bitemporal (
    contract_id          INT,
    contract_name        VARCHAR(100),
    business_from        DATE,   -- Business validity start date
    business_to          DATE,   -- Business validity end date
    system_from          TIMESTAMP, -- Time this record became valid in the DB
    system_to            TIMESTAMP, -- Time this record was invalidated (or logically deleted) in the DB
    ...
    PRIMARY KEY (contract_id, business_from, system_from)
    -- PK design method depends on requirements
);

Advantages

Disadvantages


Summary and Selection Points

  1. Nontemporal
    • Optimal for scenarios where "only managing the current state is sufficient" and "no need to trace history."
    • Simplest design, implementation, performance, and operation.
  2. Unitemporal
    • Effective when some degree of past or future history management is desired.
    • Choose when either system time or business time is critical.
  3. Bitemporal
    • Used when both system time and business time need to be accurately managed, and past states need to be flexibly reproduced and corrected.
    • Most functional but challenging in design, implementation, and operation, with data volume prone to increase.

Considerations for Selection

Supplementary

Tags: Bi-Temporal Uni-Temporal Non-Temporal DB
Share: 𝕏 Post Facebook Hatena
✏️ View source / Discuss on GitHub
☕ Support

If you enjoy this blog, consider supporting it. Every bit helps keep it running!


Related Articles