We are using postgres 9.2 version on Centos operating system. We have around 1300+ tables.We have following auto vacuum settings are enables. Still few of the tables(84 tables) which are always busy are not vacuumed.Dead tuples in those tables are more than 5000. Due to that tables are bloating and observed few areas has performance degradation.
autovacuum = on
log_autovacuum_min_duration = 100
autovacuum_max_workers = 5
autovacuum_naptime = 1min
autovacuum_vacuum_threshold = 40
autovacuum_analyze_threshold = 20
autovacuum_vacuum_scale_factor = 0.1
autovacuum_analyze_scale_factor = 0.05
autovacuum_freeze_max_age = 200000000
autovacuum_vacuum_cost_delay = 30ms
autovacuum_vacuum_cost_limit = 1200
# - Cost-Based Vacuum Delay -
#vacuum_cost_delay = 0ms # 0-100 milliseconds
#vacuum_cost_page_hit = 1 # 0-10000 credits
#vacuum_cost_page_miss = 10 # 0-10000 credits
#vacuum_cost_page_dirty = 20 # 0-10000 credits
vacuum_cost_limit = 200 # 1-10000 credits
In order to avoid the table bloating and performance degradation,we would like to set the ' autovacuum_vacuum_scale_factor'(zero) and 'autovacuum_vacuum_threshold ' (200) settings for the busy tables as below. Please let me know is there any adverse effect on DB if I set autovacuum scale factor to zero for certain tables. If yes, what is the effect and how to test.
ALTER TABLE cmdevice SET (autovacuum_vacuum_scale_factor = 0, autovacuum_vacuum_threshold = 200);
Kindly let me know the role of autovacuum_vacuum_cost_delay and autovacuum_vacuum_cost_limit settings .