Available from PostgreSQL 13.
Use multiple cores to run VACUUM.
When PostgreSQL runs vacuum, it marks spaces in a table available for re-use. It does not actually return the space to the operating systems, so PostgreSQL can use multiple CPUs to process indexes.
Parallel VACUUM does not need exclusive lock. So you can still do
So if you have a table that has many indexes, PostgreSQL can vacuum your indexes concurrently.
You can manually specify number of cores to
VVACUUM (ANALYZE, VERBOSE, PARALLEL 8) users;
You can use up to 8 cores
max_parallel_maintenance_workers. An index will could be parallel vacuum candidate if it is bigger than min_parallel_index_scan_size.
1 core works on 1 index.
Parallel workers only launched when there are 2+ indexes in the table.
You also need to tune
You cant use
PARALLEL option with
=# VACUUM (FULL, PARALLEL 8) users; ERROR: VACUUM FULL cannot be performed in parallel