Is it possible? I have a table with fast growing dead tuples, but I can\'t see any update or delete to the table during the day, just inserts and selects. Autovacuum runs ea
A failed attempt to insert data may cause dead tuples. Example:
create table test(id serial primary key, str text);
insert into test (str) values ('abc');
select pg_stat_get_dead_tuples('test'::regclass);
pg_stat_get_dead_tuples
-------------------------
0
(1 row)
insert into test values (1, 'def');
ERROR: duplicate key value violates unique constraint "test_pkey"
DETAIL: Key (id)=(1) already exists.
select pg_stat_get_dead_tuples('test'::regclass);
pg_stat_get_dead_tuples
-------------------------
1
(1 row)
This also applies to the inserts aborted due to rollback.