We are trying to use the info in pg_Stat_all_tables to debug our applcation(see how much inserts/updates/deletes since the last reset). However we found some scenarios where the data in the view isnt accurate :
1)When you preform a rollback all the inserts/updates/deletes you did are added to the n_tup_ins/upd/del column :
postgres=# \d pgstat.pg_stat_all_tables;^C
postgres=# create table test(a int);
postgres=# select relname, n_live_tup,n_tup_ins,n_tup_del,n_tup_upd from pg_Stat_all_tables where relname='test';
2)sometimes the n_tup_ins isnt accurate and it takes some time until it is updated. Does someone has an explanation for it ? During that time analyze isnt running so it seems might be something else.