Re: Per table autovacuum vacuum cost limit behaviour strange - Mailing list pgsql-hackers

From Haribabu Kommi
Subject Re: Per table autovacuum vacuum cost limit behaviour strange
Date
Msg-id CAJrrPGeDEYpvHoR4m-cs2Ct9wTC3bqurreHNyVGC8smS7eig+g@mail.gmail.com
Whole thread Raw
In response to Re: Per table autovacuum vacuum cost limit behaviour strange  (Mark Kirkwood <mark.kirkwood@catalyst.net.nz>)
Responses Re: Per table autovacuum vacuum cost limit behaviour strange  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Re: Per table autovacuum vacuum cost limit behaviour strange  (Alvaro Herrera <alvherre@2ndquadrant.com>)
List pgsql-hackers
On Thu, Feb 13, 2014 at 3:31 PM, Mark Kirkwood wrote:
On 13/02/14 17:13, Haribabu Kommi wrote:
When I go through the code for checking the same, I got the following
behavior.

The default values of vacuum parameters - cost_limit - 200 and cost_delay -
0
The default values of auto vacuum parameters - cost_limit - (-1) and
cost_delay - 20ms.

1. User is not provided any vacuum parameters to the table, so the vacuum
options for the table are cost_limit - 200 and cost_delay - 20
2. User is provided cost_limit as 1000 to the table, so the vacuum options
for the table are cost_limit - 1000 and cost_delay - 20

For the above two cases, the "autovac_balance_cost" function sets the cost
parameters as cost_limit - 200 and cost_delay - 20.

3. User is provided cost_limit as 1000 and cost_delay as 10 to the table,
so the vacuum options for the table are cost_limit - 1000 and cost_delay -
10

This case the cost_limit - 100 and cost_delay - 10.

4. User is provided cost_limit as 1000 and cost_delay as 100 to the table,
so the vacuum options for the table are cost_limit - 1000 and cost_delay -
100

This case the cost_limit - 1000 and cost_delay - 100

 From the above observations, The cost parameters of vacuum are not working
as they specified.
please correct me if anything wrong in my observation.


FWIW - I can confirm these calculations in 9.4devel. I found the attached patch handy for logging what the balanced limit and delay was.

I changed the balance cost calculations a little bit to give priority to the user provided per table autovacuum parameters.
If any user specified per table vacuum parameters exists and those are different with guc vacuum parameters then the
balance cost calculations will not include that worker in calculation. Only the cost is distributed between other workers
with specified guc vacuum cost parameter.

The problem in this calculation is if the user provides same guc values to the per table values also then it doesn't consider them in calculation.
Patch is attached in the mail. please provide you suggestions or corrections in this approach.

Regards,
Hari Babu
Fujitsu Australia
Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: narwhal and PGDLLIMPORT
Next
From: Jerry Sievers
Date:
Subject: HBA files w/include support?