Hi, I noticed that the parallel workers can go over the vacuum cost budget, with both parallel vacuum and parallel autovacuum. For example, with the default cost delay of 2ms and cost limit of 200, each of the 4 parallel workers and the autovacuum worker (the leader) sleeps 2ms for every 200 cost units it incurs on its own, so each of the 5 processes runs at the full budget. If the 200 were the budget for the vacuum as a whole, each process would have to sleep 5 times longer, that is 2ms per 40 cost units.
I think this is a problem, since the cost budget the user was promised gets crossed. Please find the attached patch fixing this. Although this exists for parallel vacuum too, back-patching it to PG19, where parallel autovacuum was introduced, is fine, since parallel autovacuum runs with the default cost delay and cost limit. Thoughts? -- Bharath Rupireddy Amazon Web Services: https://aws.amazon.com
v1-0001-Parallel-vacuum-workers-together-with-leader-coul.patch
Description: Binary data
