HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

how to enable temporal database capability in mysql.?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
temporalenablecapabilitydatabasemysqlhow

Problem

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.

Solution

-
Add a from_date field, and a nullable to_date field

-
expand your primary key to include from_date

-
keep everything in UTC

-
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

Context

StackExchange Database Administrators Q#13904, answer score: 6

Revisions (0)

No revisions yet.