K
K
KingOfNothing2011-10-03 08:53:04
PostgreSQL
KingOfNothing, 2011-10-03 08:53:04

Storing and processing data versions using PostgreSql?

Is it possible in PostgreSql to organize by means of the DBMS itself or with the help of some plugins, saving the history of data changes in the database (for example, like binary log in MySQL)? It is also of interest that this story can be read and the data restored to some version.
In general, I’m interested in how you can organize the versioning of the database, for example, so that each transaction generates a new version of the database, and it is possible to roll back from one version to another (or rather, not completely roll back - but read the changes made and restore some entity in the database to the desired state).
PS at the moment, it is planned to do at the application logic level and store changes in the database itself. I would like to achieve the same effect using dbms, if possible.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
XuMiX, 2011-10-03
@XuMiX

You can look in this direction, for example
www.postgresql.org/docs/9.0/static/runtime-config-wal.html
www.postgresql.org/docs/9.0/static/continuous-archiving.html

I
Isopropil, 2011-10-06
@Isopropil

Do you mean something like retrospective queries in Oracle? Unfortunately, PostgreSQL does not yet know how to do this.
If you want to store a history of data changes, you can write a trigger that will drop the history of changes into a table, i.e. you don't have to do everything at the application level. You can write a universal trigger, for example, in pl/perl, or even arrange it as a plug-in in C (the performance will be higher), which will write the history in a form convenient for you. If it suits you, I can help with writing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question