Versioning data in Postgres? Testing a git like approach – Specfy

Versioning data in Postgres? Testing a git like approach – Specfy is fashinating but I think that most of the time these two proposed alternatives fit most of the needs:

  1. In-Table versioning, the WordPress way of doing thing. Add a a column version (or modify date) and SELECT the maximum version. It’s simple and doesn’t require maintaining multiple schema or resources. However it has massive drawback in term of performance, and query simplicity. The table will inevitably grow, and SELECT needs to have an order by which can make joining/grouping/aggregating harder or slower.
  2. Copy table versioning: the most simple and efficient alternative. Create a quasi equivalent copy of the table your are versioning, migration is almost 1:1. However you still need to add metadata fields, disable or rename primary key to allow the same id to be inserted multiple times. And you obviously need one table per versionned table.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.