Postgresql 9.3即使是激进的设置,Autovacuum也没有跟上

时间:2018-05-12 20:05:35

标签: postgresql postgresql-9.3 vacuum autovacuum

试图让Postgresql保持表格更加清晰,但即使在调整资源限制后,它似乎也几乎没有保持最新状态。

即使在设置

之后
ALTER TABLE veryactivetable SET (autovacuum_vacuum_threshold = 10000);

非常活跃的pg_stat_user_tables返回63356 n_dead_tup和last_autoanalyze& last_autovacuum超过24小时

posgresql.conf设置:

shared_buffers = 7680MB
work_mem = 39321kB

maintenance_work_mem = 1920MB

vacuum_cost_delay = 0
vacuum_cost_page_hit = 1000
vacuum_cost_page_miss = 1000
vacuum_cost_page_dirty = 2000
vacuum_cost_limit = 7000


autovacuum = on
log_autovacuum_min_duration = 0
autovacuum_max_workers = 10
autovacuum_naptime = 10s
autovacuum_vacuum_threshold = 50
autovacuum_analyze_threshold = 50
autovacuum_vacuum_scale_factor = 0.05
autovacuum_analyze_scale_factor = 0.05
autovacuum_freeze_max_age = 200000000
autovacuum_vacuum_cost_delay = 50ms
autovacuum_vacuum_cost_limit = 7000

1 个答案:

答案 0 :(得分:0)

> RENAME MEASUREMENTS 'OLD_NAME' to 'NEW_NAME' ERR: error parsing query: found RENAME, expected SELECT, DELETE, SHOW, CREATE, DROP, EXPLAIN, GRANT, REVOKE, ALTER, SET, KILL at line 1, char 1 autovacuum_vacuum_scale_factor设置为更高的值,可能最好回到默认值。无需让autovacuum更频繁地运行,特别是在您的情况下。我们的想法是让它在启动后快速完成。

autovacuum_analyze_scale_factor设置得更高,更接近原始默认值一分钟。

autovacuum_naptime恢复为3,除非你有很多数据库或很多表。

如果要尽快(这是目标)进行自动真空完成,您应该做的是将autovacuum_max_workers设置为0.

如果您只有几张非常繁忙的牌桌,最好将它设置在您在问题中显示的那些牌桌上。