Bitemporal modeling
# Bitemporal modeling

Bitemporal modeling is a specific case of temporal database information modeling technique designed to handle historical data along two different timelines. This makes it possible to rewind the information to "as it actually was" in combination with "as it was recorded" at some point in time. In order to be able to do so, information cannot be discarded even if it is erroneous. Within, for example, financial reporting it is often desirable to be able to recreate an old report both as it actually looked at the time of creation and as it should have looked given corrections made to the data after its creation.

Implementations of bitemporal modeling can be done using relational databases and graph databases. As such, bitemporal modeling is considered different from dimensional modeling and complementary to database normalization. The SQL:2011 standard provides language constructs for working with bitemporal data. However, many of current solutions are still vendor-specific.

## Philosophy

Bitemporal modeling uses bitemporal structures as the basic components. This results in the databases which have a consistent type of temporality for all data.

## Benefits of bitemporal modeling

By focusing on completeness and accuracy of data, bitemporal modeling facilitates the creation of complete audit trails of data. All data becomes immutable. Specifically this allows for queries which provide:

* The most accurate data possible as we know it now
* Data as we knew it at any point in time
* When and why the most accurate data we had changed

## Implementations in notable products

* MarkLogic introduced bitemporal data support in version 8.0. Time stamps for Valid and System time are stored in JSON or XML documents.
* XTDB (formerly Crux) is an open source database that indexes documents using an EAV data model and provides point-in-time bitemporal SQL & Datalog queries.
* TerminusDB is an open source document-oriented graph database that uses delta encoding and provides bitemporal functionality
