云数据库 RDS-AutoVacuum介绍和调优:autovacuum的相关参数

时间:2024-12-20 17:08:41

autovacuum的相关参数

可以通过查询pg_settings系统表来查看autovacuum参数:

select category, name,setting,unit,source,min_val,max_val from pg_settings where category = 'Autovacuum' ;
category  |                name                 |  setting  | unit | source  | min_val |  max_val   
------------+-------------------------------------+-----------+------+---------+---------+------------
 Autovacuum | autovacuum                          | on        |      | default |         | 
 Autovacuum | autovacuum_analyze_scale_factor     | 0.1       |      | default | 0       | 100
 Autovacuum | autovacuum_analyze_threshold        | 50        |      | default | 0       | 2147483647
 Autovacuum | autovacuum_freeze_max_age           | 200000000 |      | default | 100000  | 2000000000
 Autovacuum | autovacuum_max_workers              | 3         |      | default | 1       | 262143
 Autovacuum | autovacuum_multixact_freeze_max_age | 400000000 |      | default | 10000   | 2000000000
 Autovacuum | autovacuum_naptime                  | 60        | s    | default | 1       | 2147483
 Autovacuum | autovacuum_vacuum_cost_delay        | 2         | ms   | default | -1      | 100
 Autovacuum | autovacuum_vacuum_cost_limit        | -1        |      | default | -1      | 10000
 Autovacuum | autovacuum_vacuum_scale_factor      | 0.2       |      | default | 0       | 100
 Autovacuum | autovacuum_vacuum_threshold         | 50        |      | default | 0       | 2147483647

autovacuum的工作量取决于两个参数:

  • autovacuum_vacuum_cost_limit是自动清理一次性完成的工作量。
  • autovacuum_vacuum_cost_delay是自动清理在达到autovacuum_vacuum_cost_limit参数指定的开销后休眠的毫秒数。
support.huaweicloud.com/usermanual-rds/rds_pg_08_00015.html