DBAtlas · Database operations atlas

Tune autovacuum for a specific table

PostgreSQLMaintenance

Command

ALTER TABLE customer SET (autovacuum_vacuum_scale_factor = 0.02, autovacuum_vacuum_threshold = 5000, autovacuum_analyze_scale_factor = 0.01);

What it does

Lowers the autovacuum trigger thresholds for this table only, so large/busy tables are vacuumed more often.

When to use it

When autovacuum falls behind on large tables with heavy UPDATE/DELETE activity.

Caution

Overly aggressive settings can lead to constant autovacuum runs and I/O load. To revert the setting: ALTER TABLE customer RESET (autovacuum_vacuum_scale_factor);

Open in DBAtlas →

Related