autovacuum_max_workers - AWS Prescriptive Guidance

autovacuum_max_workers

The autovacuum_max_workers parameter controls the maximum number of worker processes that the autovacuum process can create. Each worker process is responsible for vacuuming or analyzing a single table.

For example, let's say that you have a large database with many tables that are frequently updated and deleted. If you set the autovacuum_max_workers to a low value such as 1, only one table can be vacuumed at a time, and it takes longer for all tables to be cleaned. If you set autovacuum_max_workers to a high value such as 8, up to eight tables can be vacuumed simultaneously. This can make the cleaning process faster for databases that contain many tables.

AWS CLI syntax

The following command changes autovacuum_max_workers for a specific DB parameter group. This change applies to all instances or clusters that use the parameter group.

# Modify autovacuum_max_workers on a DB parameter group aws rds modify-db-parameter-group \ --db-parameter-group-name <parameter_group_name> \ --parameters "ParameterName=autovacuum_max_workers,ParameterValue=<new_value>,ApplyMethod=immediate" # Modify autovacuum_max_workers on a DB cluster parameter group aws rds modify-db-cluster-parameter-group \ --db-cluster-parameter-group-name <parameter_group_name> \ --parameters "ParameterName=autovacuum_max_workers,ParameterValue=<new_value>,ApplyMethod=immediate"

Type: Static (applying changes requires a reboot)

Default value: GREATEST(DBInstanceClassMemory/64371566592,3) workers

Increasing the autovacuum_max_workers setting can increase the load on the server, which can impact performance if you don't have enough resources. The optimal setting depends on the specific requirements of your database, its size, and the number of tables it contains. We recommend that you experiment with different values and monitor performance to find the optimal setting for your use case.