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

Reply via email to