I need to check if some rows were inserted into one specific table. I need to check it on a daily basis.
I've already tried to use pg_stat_all_tables.n_live_tup
for that, but I am not sure if that works correct and was originally designed for that purposes.
Also do columns n_tup_ins
, n_tup_upd
, n_tup_del
depict if any rows were inserted, updated or deleted?
These statistical data are collected and updated by the statistics collector process. Individual database backends send statistical information to the statistics collector via an UDP socket.
This has two consequences:
The information is used internally to trigger autovacuum and autoanalyze, so it does not matter if the numbers are 100% accurate or not. If that is good enough for your purposes, then you can certainly use that information.