Given postgres 11.

I'm looking for statistics on how often a particular table gets something inserted/updated/deleted.

There's of course this: https://www.postgresql.org/docs/11/monitoring-stats.html

And the pg_stat_all_tables view.

Which has:

n_tup_ins   bigint  Number of rows inserted
n_tup_upd   bigint  Number of rows updated (includes HOT updated rows)
n_tup_del   bigint  Number of rows deleted
n_tup_hot_upd   bigint  Number of rows HOT updated (i.e., with no separate index update required)

This gives the absolute number, but not the frequency or growth over time.

Does something like that exist or will I have to make that myself?

  • 1
    There is nothing built-in. You need to take snapshot of that table to get that information – a_horse_with_no_name Aug 24 at 6:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.