Re: "VACUUM FULL ANALYZE" vs. Autovacuum Contention

Поиск
Список
Период
Сортировка
От Greg Smith
Тема Re: "VACUUM FULL ANALYZE" vs. Autovacuum Contention
Дата
Msg-id 4E16258A.4050007@2ndQuadrant.com
обсуждение исходный текст
Ответ на "VACUUM FULL ANALYZE" vs. Autovacuum Contention  (D C <ptradingcom@gmail.com>)
Ответы Re: "VACUUM FULL ANALYZE" vs. Autovacuum Contention  (D C <ptradingcom@gmail.com>)
Список pgsql-performance
On 07/07/2011 04:30 PM, D C wrote:
>
> autovacuum_naptime = 30s
> autovacuum_vacuum_threshold = 200
> autovacuum_vacuum_scale_factor = 0.5
> autovacuum_vacuum_cost_delay = 10
>

These are slightly strange settings.  How did you come up with them?
The autovacuum_vacuum_scale_factor being so high is particularly
dangerous.  If anything, you should be reducing that from its default of
0.2, not increasing it further.

> In addition to autovacuuming, each day, early, in the morning, we run
> a full vacuum, like this: "vacuumdb --all --full --analyze".  We do
> not have any special variable set for vacuum in postgresql.conf.
>

VACUUM FULL takes an exclusive lock on the table while it runs, and it
extremely problematic for several other reasons too.  See
http://wiki.postgresql.org/wiki/VACUUM_FULL for more information.

You didn't mention your PostgreSQL version so I can't be sure exactly
how bad of a problem you're causing with this, but you should almost
certainly stop doing it.


> The problem is that once or twice a week, the "vacuum full analyze"
> seems to cancel out the autovacuum that has already started at the
> same time.  E.g.,
>

Yes.  VACUUM FULL needs to take a large lock on the table, and it will
kick out autovacuum in that case, and cause countless other trouble
too.  And if the VACUUM FULL is already running, other things will end
up getting stuck waiting for it, and all sorts of locking issues can
come out of that.

You should remove the "--full" from your daily routine, reduce
autovacuum_vacuum_scale_factor back to a reasonable number again, and
see how things go after that.  You're trying to use PostgreSQL in a way
it's known not to work well right now.

> I am guessing that we can do the above by setting the
> "autovacuum_vacuum_cost_limit" to a fairly high value (rather than it
> not being set at all, as it is right now, and thus inheriting the
> "200" default value from vacuum_cost_limit).
>

The cost limit has nothing to do with the issue you're seeing.  It
adjust how much work autovacuum does at any moment in time, it isn't
involved in any prioritization.

--
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
Comprehensive and Customized PostgreSQL Training Classes:
http://www.2ndquadrant.us/postgresql-training/


В списке pgsql-performance по дате отправления:

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: "VACUUM FULL ANALYZE" vs. Autovacuum Contention
Следующее
От: Dean Rasheed
Дата:
Сообщение: Re: [GENERAL] DELETE taking too much memory