large number dead tup - Postgres 9.5 - Mailing list pgsql-general

From Patrick B
Subject large number dead tup - Postgres 9.5
Date
Msg-id CAJNY3iu2rWB8Vfe-rRME2pnfnbNrMh34r4POjWX0f3J1JrEhiA@mail.gmail.com
Whole thread Raw
Responses Re: large number dead tup - Postgres 9.5
Re: large number dead tup - Postgres 9.5
List pgsql-general
Hi guys,

select schemaname,relname,n_live_tup, n_dead_tup from pg_stat_all_tables where relname = 'parts';


schemaname relname       n_live_tup n_dead_tup 
---------- ------------- ---------- ---------- 
public     parts 191623953  182477402 


See the large number of dead_tup?

My autovacuum parameters are:

"autovacuum_vacuum_threshold" : "300",
"autovacuum_analyze_threshold" : "200",
"autovacuum_vacuum_scale_factor" : "0.005",
"autovacuum_analyze_scale_factor" : "0.002", 

Table size: 68 GB

Why does that happen? Autovacuum shouldn't take care of dead_tuples?

Because of that the table is very slow... 
When I do a select on that table it doesn't use an index, for example:


\d parts;
    "index_parts_id" btree (company_id)
    "index_parts_id_and_country" btree (company_id, country) 
 


explain select * from parts WHERE company_id = 12;

Seq Scan on parts  (cost=0.00..6685241.40 rows=190478997 width=223)
  Filter: (company_id = 12) 


Thanks
Patrick 

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Duplicate data despite unique constraint
Next
From: Venkata B Nagothi
Date:
Subject: Re: large number dead tup - Postgres 9.5