Re: AutoVacuum Behaviour Question

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Bruce McAlister <bruce(dot)mcalister(at)blueface(dot)ie>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: AutoVacuum Behaviour Question
Date: 2007-06-22 22:46:12
Message-ID: 20070622224612.GB10965@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Bruce McAlister wrote:
> Hi All,
>
> I have enabled autovacuum in our PostgreSQL cluster of databases. What I
> have noticed is that the autovacuum process keeps selecting the same
> database to perform autovacuums on and does not select any of the others
> within the cluster. Is this normal behaviour or do I need to do
> something more elaborate with my settings?

There are two reasons autovacuum would keep picking up the same
database:

1. the other databases do not have pgstat entries.

2. this database is in danger of Xid wraparound and the vacuum run
fails to complete for some reason.

> Our main concern is the "blueface-service" database. The sipaccounts
> table has some high traffic, mainly updates.

Are there non-null values in the pg_stat views for tables in
blueface-service database? If there are, then you can discard (1) as
the problem. If all values are nulls for all tables, then you have the
stats collector disabled for that database, or something (maybe by ALTER
DATABASE ... SET). In this case, reenable it and issue a manual VACUUM
so that pgstat is populated. (I think the easiest way to check is
SELECT datname, datconfig FROM pg_database).

Regarding (2) you would need to check whether the autovacuum run dies
with an ERROR. I'd advise setting a log_line_prefix that included the
PID (%p) so that you can check whether the process goes away cleanly or
it dies early. It is not impossible that a corrupt index or table is
causing autovacuum to die, but it should certainly show up in the logs.

--
Alvaro Herrera Valdivia, Chile ICBM: S 39º 49' 18.1", W 73º 13' 56.4"
"El que vive para el futuro es un iluso, y el que vive para el pasado,
un imbécil" (Luis Adler, "Los tripulantes de la noche")

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tony Caduto 2007-06-22 22:58:56 Re: Proposed Feature
Previous Message Francisco Reyes 2007-06-22 22:15:08 Re: pg_restore out of memory

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-06-22 23:13:01 Refactoring parser/analyze.c
Previous Message Kevin Grittner 2007-06-22 21:25:37 fast stop before database system is ready