Mysql – how to enable temporal database capability in thesql.

database-designMySQLmysql-5.5

How to enable the temporal database compatibility in mysql database?

Is there any library or a plug-in to enable the temporal upward compatibility? I want to keep the past records whenever a current record changes.

Best Answer

  1. Add a from_date field, and a nullable to_date field

  2. expand your primary key to include from_date

  3. keep everything in UTC

  4. consider using PostgreSQL as there is a temporal extension for preventing overlapping time periods.

Here is the book from "THE" temporal db guy (Snodgrass):

http://www.cs.arizona.edu/~rts/tdbbook.pdf

Also try Chapter 4 of Celko's Smarties book