Time in a database

For some applications, the ability to be able to trace the different states during the lifetime of data can be very important. Especially when it comes to debugging. This is mostly relevant for data stored in a database, but could potentially also be interesting for in memory data structures. Luckily many databases today support this as change data capture. I would add to the article that the capturing the user as part of the change can be very effective.

I have recently been involved in the development of two systems where this pattern has been employed to great success. One where this was implemented in hand, and one where CDC in SQL server was used. The hand implemented solution had some special requirements that meant we did this in hand, and it also doesn’t tie us to a particular db. While not free at all, once it is up and running, it provides an invaluable tool for reasoning about the data.

I was very pleasantly surprised when datomic was announced with a time model as one of the core concepts. I really think that in this age where storage is so cheap, that we can’t afford to threat data as mutable.