views:

136

answers:

5

Using a version control system for your source code (like subversion) makes sense because it allows you to back out of mistakes, audit changes, make painless snapshots, discover exactly where something went wrong so that you can improve your process etc. For the same reasons it makes sense to do change tracking of business data, and many systems do so.

There are already a few questions on how to implement this on top of a normal database:

For a feature that is so useful and popular, it seems strange that we all need to reinvent the wheel. Are there any existing database implementations which already solved this problem? I'm imagining that such a system would extend the SQL syntax to allow easy querying of the history.

A: 

The space requirements would be prohibitive, so this is why you typically roll your own.

There are different solutions, depending on your toolkit:

Robert Munteanu
This doesn't make sense. Yes, such databases are inherently bulky. Why does that mean you should roll your own, though?
Matthew Flaschen
Roll your own - implement it yourself.
Robert Munteanu
I know what roll your own means. The question is why.
Matthew Flaschen
+1 Hibernate Envers seems worth looking into
Wim Coenen
@Matthew Flaschen - I misread your question, sorry. I meant to say that in my opinion this is a situation where it's too difficult to specify exactly what/how/for how long/where to archive so there is no general implementation available, therefore the solutions are custom-made.
Robert Munteanu
+3  A: 

Take a look at temporal databases, such as TimeDB.

Matthew Flaschen
+1 for putting a name on the concept so that I can finally get some relevant google hits :-)
Wim Coenen
+1  A: 

Not a relational database (you didn't say it had to be), but CouchDB has versioning built-in.

musicfreak
+1 interesting. A very fresh approach to the whole problem of storing and querying data.
Wim Coenen
A: 

Given that most countries require that all accounting transactions are logged, pretty well every database lets you record the history for auditing.

Pete Kirkham
I'm looking for "lets you query the history", not "lets you record the history".
Wim Coenen
If your original schema has time stamps, it's not a problem.If your original schema does not, load the history adding them.
Pete Kirkham
A: 

As far as the data goes, I believe it's called "change data capture".

duffymo