Running a regular VACUUM command is a pretty intensive operation. It's likely to become the most resource intensive process running on your server, and if autovacuum ran in that fashion it would be unusable in many environments.
Fortunately, there's another approach available. Cost-based vacuuming limits the amount of disk I/O any given VACUUM or autovacuum process is expected to do per unit of time. It works by assigning an estimated cost to every I/O operation, accumulating a total for each operation it performs, then pausing once an upper limit on cost per iteration is exceeded.
The cost estimation presumes three basic operations VACUUM performs, each with their own presumed amount of work to handle:
- Page hit: A data ...