Finding data recently created/updated in a whole PostgreSQL database

Posted on

Question :

I have inherited a web application running on a PostgreSQL database, which I don’t know well, and there is little documentation for the code and the database…

So I try to understand things like “which data is created/updated in the database when I perform this action in the web interface ?”.

I know I could just look at the code of the application, but it’s quite confuse and opaque.

I also know I can use track_commit_timestamp=on to find the last commit on a given table (see https://dba.stackexchange.com/a/168752/144567).

But what I would like is find the last changed data in the whole database (there is more than 900 tables), is it possible ? Thanks.

Postgres version is 9.6.

Answer :

Rather than trying to look at the data that changed, I would start by looking at the commands that changed it. Set log_statement = mod in the postgresql.conf.

Leave a Reply

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