试图让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
答案 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.
如果您只有几张非常繁忙的牌桌,最好将它设置在您在问题中显示的那些牌桌上。