News for hackers. Stuff that matters.
Re:Datomic Is Now Free by wwweston on Thursday April 27, 2023 @04:35PM (#35734167)
Yeah, it seems you could be able to substitute thoughtful schema design avoiding updates/deletes for time-travel as a feature.

I wonder if anyone has made a collection of reference examples implemented this way (and in general think that a substantial compendium good examples of DB schema and thinking behind them could be worthwhile).

Re:Datomic Is Now Free by twic on Thursday April 27, 2023 @04:44PM (#35734284)
I'm moderately confident you could mechanically transform a time-oblivious schema into a history-preserving one, and then write a view on top of it which gave a slice at a particular time. Moderately.
Re:Datomic Is Now Free by ysleepy on Thursday April 27, 2023 @05:50PM (#35735064)
That is essentially what MVCC does.
Re:Datomic Is Now Free by twic on Thursday April 27, 2023 @06:33PM (#35735371)
That is an extremely good point.
Re:Datomic Is Now Free by JohnBooty on Thursday April 27, 2023 @11:26PM (#35737161)
Yes, although AFAIK those hidden MVCC columns (xmin, xmax?) aren't very usable from an application standpoint -- the obsoleted rows only hang around until the next VACUUM, right?

I realize you're not claiming those columns are useful from an application perspective. Just curious to know if I'm wrong and they are....

Re:Datomic Is Now Free by twic on Friday April 28, 2023 @06:25AM (#35739499)
Oracle lets you use the MVCC data to query past states of the database, called "flashback":

https://docs.oracle.com/en/database/oracle/oracle-database/2...

You can configure how long the old data is kept:

https://docs.oracle.com/en/database/oracle/oracle-database/2...

Worked examples:

http://www.dba-oracle.com/t_rman_149_flasbback_query.htm

Re:Datomic Is Now Free by JohnBooty on Friday April 28, 2023 @10:02AM (#35741369)
Wow, super informative. Thank you so much.
Re:Datomic Is Now Free by ysleepy on Saturday April 29, 2023 @05:42AM (#35751487)
I meant MVCC is the proof that you can automate the transform of a schema into a versioned schema. How and if the DBMS exposes that is another concern.

The garbage collection / VACUUM part of an MVCC system is the harder part, saving all versions and querying a point in time is the easy one.

Re:Datomic Is Now Free by rehevkor5 on Thursday April 27, 2023 @05:27PM (#35734850)
Maybe search around on bitemporal database table modeling.
Re:Datomic Is Now Free by pjot on Thursday April 27, 2023 @05:55PM (#35735091)
It’s called a slowly changing dimension. In this example, it’s a type-2.

https://en.m.wikipedia.org/wiki/Slowly_changing_dimension

Re:Datomic Is Now Free by mjul on Friday April 28, 2023 @11:54AM (#35742928)
Snodgrass wrote a whole book on that topic: Developing Time-Oriented Database Applications in SQL (1999).

It is available as PDF on his publications page:

https://www2.cs.arizona.edu/~rts/publications.html

Re:Datomic Is Now Free by jskulski on Friday April 28, 2023 @09:11PM (#35749017)
Ive built a couple systems that would have been datomic’s bread and butter.

Each time the company was more comfortable with mainstream dbs, so we ended going with something like you’re talking about, built on top of a db. A couple of the projects were because a mainstream dbs wouldn’t scale.

The systems definitely worked, but it was also a lot of implementation complexity on an other wise simple business prop: “store this data as facts”