Re: insert/update performance - Mailing list pgsql-hackers

From Jinhua Luo
Subject Re: insert/update performance
Date
Msg-id CAAc9rOzZyb_jutc9dVmdn=8jiqybvSfYY75wnm3YJim76p-s5g@mail.gmail.com
Whole thread Raw
In response to Re: insert/update performance  (Jinhua Luo <luajit.io@gmail.com>)
List 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



pgsql-hackers by date:

Previous
From: Jinhua Luo
Date:
Subject: Re: insert/update performance
Next
From: Victor Wagner
Date:
Subject: Re: Patch: Implement failover on libpq connect level.