autovacuum is constantly running

While autovacuum stays running all the time, it shouldn't be doing active work all the time. If it is, there are two common issues to investigate.

Each time VACUUM runs out of its allocated space for maintenance_work_mem, it needs to start over and make an additional pass over the table. Accordingly, if you have set this tunable too low relative to the size needed to vacuum your tables, VACUUM can run much less efficiently than it should, and therefore autovacuum will be running much more often just to keep up.

Another autovacuum problem is related to having a large number of databases. Autovacuum tries to start one worker on each database every autovacuum_naptime seconds (defaulting to one minute), up the ...

Get PostgreSQL 10 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.