PostgreSQL配置文件--AUTOVACUUM参数

8 AUTOVACUUM参数 AUTOVACUUM PARAMETERS

8.1 autovacuum

字符型
默认: autovacuum = on                        
Enable autovacuum subprocess?  'on' ,requires track_counts to also be on.
表示是否开起autovacuum。特别的,当需要冻结xid(事务ID)时,尽管此值为off,PG也会进行vacuum。 

8.2 log_autovacuum_min_duration

数字型
默认: log_autovacuum_min_duration = -1       单位ms
在规定时长内未完成的vacuum予以记录日志
-1表示禁用,0表示所有的,大于0仅记录超过时间的

8.3 autovacuum_max_workers

数字型
默认: autovacuum_max_workers = 3
autovacuum最大线程数
CPU核多,并且IO好的情况下,可多点,但是注意16*autovacuum mem,会消耗较多内存,所以内存也要有基础。
重启数据库生效

8.4 autovacuum_naptime

数字型
默认: autovacuum_naptime = 1min
time between autovacuum runs
两次vacuum间隔时间

8.5 autovacuum_vacuum_threshold

数字型
默认: autovacuum_vacuum_threshold = 50
min number of row updates before vacuum
达到某表DML操作的最小行数则vacuum

8.6 autovacuum_analyze_threshold

数字型
默认: autovacuum_analyze_threshold = 50
min number of row updates before analyze
激活自动analyze操作的最小行数,analyze有利于对SQL语句进行更精准的plan(这是由于explain用到的pg_class列reltuples and relpages are not updated on-the-fly)

8.7 autovacuum_vacuum_scale_factor

数字型
默认: autovacuum_vacuum_scale_factor = 0.2
fraction of table size before vacuum
表示autovacuum的vacuum操作所需的变更量阈值,当这个表的update/delete的tuple总数大于(pg_class.reltuples*autovacuum_vacuum_scale_factor+autovacuum_vacuum_threshold)时, 触发vacuum操作
建议不要太高频率,否则会因为vacuum产生较多的XLOG

8.8 autovacuum_analyze_scale_factor

数字型
默认: autovacuum_analyze_scale_factor = 0.1
fraction of table size before analyze
表示autovacuum的analyze操作所需的变更量阈值,当这个表的INSERT/update/delete的tuple总数大于(pg_class.reltuples*autovacuum_analyze_scale_factor+autovacuum_analyze_threshold)时, 触发analyze操作

8.9 autovacuum_freeze_max_age

数字型
默认: autovacuum_freeze_max_age = 200000000
maximum XID age before forced vacuum
某表的pg_class.relfrozenxid的最大值,如果超出此值则重置xid

8.10 autovacuum_multixact_freeze_max_age

数字型
默认: autovacuum_multixact_freeze_max_age = 400000000       
maximum multixact age before forced vacuum

8.11 autovacuum_vacuum_cost_delay

数字型
默认: autovacuum_vacuum_cost_delay = 20ms    
default vacuum cost delay for autovacuum, in milliseconds
-1意味着使用vacuum_cost_delay
运行一次vacuum的时长,如果超过此值则休眠然后起来接着vacuum(vacuum很好I/O)

8.12 autovacuum_vacuum_cost_limit

数字型
默认: autovacuum_vacuum_cost_limit = -1  default vacuum cost limit for autovacuum
-1意味着使用vacuum_cost_delay

8.13 autovacuum_vacuum_cost_delay

数字型
默认: autovacuum_vacuum_cost_delay = 20ms   
default vacuum cost delay for autovacuum, in milliseconds; -1 means use vacuum_cost_delay
当autovacuum进程即将执行时,对vacuum执行cost进行评估,如果超过autovacuum_vacuum_cost_limit的值时,则延迟,这个延迟的时间值即为改成的值.

8.14 autovacuum_vacuum_cost_limit

数字型
默认: autovacuum_vacuum_cost_limit = -1     
default vacuum cost limit for autovacuum, -1 means use vacuum_cost_limit
autovacuum进程的评估阀值,-1表示使用vacuum_cost_limit值,如果在执行 autovacuum进程期间评估的cost超过autovacuum_vacuum_cost_limit,则autovacuum进程则会休眠

posted @ 2017-12-15 16:13  lykops  阅读(2620)  评论(0编辑  收藏  举报