Re: More detail on settings for pgavd?

From: Shridhar Daithankar <shridhar_daithankar(at)myrealbox(dot)com>
To: josh(at)agliodbs(dot)com
Cc: pgsql-performance(at)postgresql(dot)org, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: More detail on settings for pgavd?
Date: 2003-11-19 14:10:46
Message-ID: 3FBB79E6.6040701@myrealbox.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Josh Berkus wrote:

> Shridhar,
>
> I was looking at the -V/-v and -A/-a settings in pgavd, and really don't
> understand how the calculation works. According to the readme, if I set -v
> to 1000 and -V to 2 (the defaults) for a table with 10,000 rows, pgavd would
> only vacuum after 21,000 rows had been updated. This seems wrong.

No. that is correct.

It is calculated as

threshold = base + scale*numebr of current rows

Which translates to

21,000 = 1000 + 2*1000

However I do not agree with this logic entirely. It pegs the next vacuum w.r.t
current table size which is not always a good thing.

I would rather vacuum the table at 2000 updates, which is what you probably want.

Furthermore analyze threshold depends upon inserts+updates. I think it should
also depends upon deletes for obvious reasons.

> Can you clear this up a little? I'd like to tweak these settings but can't
> without being better aquainted with the calculation.

What did you expected in above example? It is not difficult to tweak
pg_autovacuum calculations. For testing we can play around.

> Also, you may want to reverse your default ratio for Vacuum/analyze frequency.
> True, analyze is a less expensive operation than Vacuum, but it's also needed
> less often -- only when the *distribution* of data changes. I've seen
> databases where the optimal vacuum/analyze frequency was every 10 min/once
> per day.

OK vacuum and analyze thresholds are calculated with same formula as shown above
but with different parameters as follows.

vacthresh = vacbase + vacscale*ntuples
anathresh = anabase + anascale*ntuples

What you are asking for is

vacthresh = vacbase*vacscale
anathresh = anabase + anascale*ntuples

Would that tilt the favour the way you want? i.e. an analyze is triggered when a
fixed *percentage* of table changes but a vacuum is triggered when a fixed
*number of rows* are changed.

I am all for experimentation. If you have real life data to play with, I can
give you some patches to play around.

And BTW, this is all brain child of Mathew O.Connor(Correct? I am not good at
either names or spellings). The way I wrote pgavd originally, each table got to
get separate threshold..:-). That was rather a brute force approach.

Shridhar

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Treat 2003-11-19 14:22:10 Re: Commercial binary support?
Previous Message Mike Mascari 2003-11-19 14:07:17 Re: Is there going to be a port to Solaris 9 x86 in the

Browse pgsql-performance by date

  From Date Subject
Next Message Bruno Wolff III 2003-11-19 15:49:59 Re: problem with select count(*) ..
Previous Message Shridhar Daithankar 2003-11-19 12:31:49 Re: Join on incompatible types