Database versioning -


I have created some projects (CMS and EC systems), which must have some data version.

Usually I come with that type of schema

  + -------------- + + + Fobar + --- --------- + + + foobar_id version + + -------------- +  

It did great work but I'm thinking if the best way to do this is to have the main problem with that solution, you'll always have to use the subquery to get the latest version.

i.e.:

  SELECT * foobar WHERE foobar_id = 2 and version = (select MAX (version) Foobar f2 WHERE f2 = 2)  

This makes most of the questions more complicated and there are some performance deficiencies

So if you create your existing version of the experience and share the pro and opposition of each method, So it would be nice

Thank you

I like to get historical data in other tables. I can make foobar_history or something similar and make FK in foobar_id. This will prevent you from using a subcube together. This is an added advantage of not polluting your primary data table with many historical data which you probably do not want to see 99% of the time when you are accessing it.

Although this data is triggered to update, you will need to copy the current data to _history and then update.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

jquery - SimpleModal Confirm fails to submit form -

php - Multiple Select with Explode: only returns the word "Array" -