How do I find the last time that a PostgreSQL database has been updated?

前端 未结 5 1982
我寻月下人不归
我寻月下人不归 2021-02-01 05:52

I am working with a postgreSQL database that gets updated in batches. I need to know when the last time that the database (or a table in the database)has been updated or modifie

5条回答
  •  终归单人心
    2021-02-01 06:19

    I like Jack's approach. You can query the table stats and know the number of inserts, updates, deletes and so:

    select n_tup_upd from pg_stat_user_tables  where relname = 'YOUR_TABLE';
    

    every update will increase the count by 1.

    bare in mind this method is viable when you have a single DB. multiple instances will require different approach probably.

提交回复
热议问题