From: | Jinhua Luo <luajit(dot)io(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: insert/update performance |
Date: | 2016-01-24 06:03:20 |
Message-ID: | CAAc9rOzZyb_jutc9dVmdn=8jiqybvSfYY75wnm3YJim76p-s5g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Victor Wagner | 2016-01-24 09:18:32 | Re: Patch: Implement failover on libpq connect level. |
Previous Message | Jinhua Luo | 2016-01-24 05:44:20 | Re: insert/update performance |