And I also found the pg_stat_all_tables may be not so accurate.

testdb=# truncate test;
testdb=# select pg_stat_reset_single_table_counters(42515);
testdb=# select
n_tup_ins,n_tup_upd,n_tup_hot_upd,n_tup_del,n_live_tup,n_dead_tup from
pg_stat_all_tables where relid=42515;
 n_tup_ins | n_tup_upd | n_tup_hot_upd | n_tup_del | n_live_tup | n_dead_tup
-----------+-----------+---------------+-----------+------------+------------
         0 |         0 |             0 |         0 |          0 |          0
(1 row)

##### run application a while

testdb=# select
n_tup_ins,n_tup_upd,n_tup_hot_upd,n_tup_del,n_live_tup,n_dead_tup from
pg_stat_all_tables where relid=42515;
 n_tup_ins | n_tup_upd | n_tup_hot_upd | n_tup_del | n_live_tup | n_dead_tup
-----------+-----------+---------------+-----------+------------+------------
     24829 |     24839 |             0 |         0 |      24829 |      24839
(1 row)

testdb=# select count(*) from test;
 count
-------
 24780
(1 row)

testdb=# vacuum verbose test;
...
DETAIL:  24780 index row versions were removed.
...
INFO:  "test": found 863 removable, 24780 nonremovable row versions in
3148 out of 3148 pages


The n_tup_ins is bigger than actual rows, and the n_tup_upd is even
bigger than n_tup_ins!

Regards,
Jinhua Luo


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to