Sample Header Ad - 728x90

how best to have a record versioning or tracking in relational database?

2 votes
3 answers
937 views
The scenario involves maintaining versions of a 'Product' object (e.g., Product table) and creating new records when the product changes to the latest version (e.g. v2 from v1). It is crucial not to update existing product records, as other objects might reference them. The goal is to update referring objects (those needing v2) while preserving the old versions (v1) for objects still using them. And at the same time, we need to keep track of how the product has evolved i.e. v1->v2->v3 I've considered two potential approaches: 1. Versioning : Assigning version labels (e.g., V1, V2) to the object to track and reference old versions if necessary. 2. LinkedList (or doubly LinkedList): Each new object includes an 'old_object_ID' pointing to the previous object's ID, enabling tracking of all past objects. Of course, there are pros and cons of both approaches like data redundancy, complex queries, and easy navigation. At the same time, we need to consider Query Performance, Concurrency, Referential Integrity, Auditing, and History **Are there alternative or more effective strategies/patterns for achieving this versioning and referencing mechanism in relational databases?**
Asked by Enigma (121 rep)
Mar 4, 2024, 09:05 AM
Last activity: Jun 23, 2024, 07:25 AM