开发者

PostgreSQL, pg_stat_all_tables.n_tup_XX

开发者 https://www.devze.com 2023-03-15 03:07 出处:网络
I\'ve been trying to get information about the number of inserts, updates and deletes on a table. I found the pg_stat_all_tables view and n_tup_ins/upd/del columns. These will tell me how ma开发者_开发

I've been trying to get information about the number of inserts, updates and deletes on a table. I found the pg_stat_all_tables view and n_tup_ins/upd/del columns. These will tell me how ma开发者_开发问答ny rows have been added to a table, but I can't find information about these values anywhere. I know they are all really collected from function

pg_stat_get_tuples_inserted(c.oid) AS n_tup_ins, 
pg_stat_get_tuples_updated(c.oid) AS n_tup_upd, 
pg_stat_get_tuples_deleted(c.oid) AS n_tup_del

The question is, what resets these values in runtime? ( If ever done ... )

Any ideas? Or am I looking in the wrong place?

Cheers /P


Use pg_stat_reset() to reset them, see the documentation.

For example

$ psql -Umyuser mydb
mydb# SELECT pg_stat_reset();
0

精彩评论

暂无评论...
验证码 换一张
取 消