Re: Vacuum Full Analyze Stalled - Mailing list pgsql-admin

From Alvaro Herrera
Subject Re: Vacuum Full Analyze Stalled
Date
Msg-id 20051003201225.GA11527@surnet.cl
Whole thread Raw
In response to Re: Vacuum Full Analyze Stalled  ("Jim C. Nasby" <jnasby@pervasive.com>)
Responses Re: Vacuum Full Analyze Stalled
Re: Vacuum Full Analyze Stalled
List pgsql-admin
On Mon, Oct 03, 2005 at 02:41:14PM -0500, Jim C. Nasby wrote:
> I haven't looked in detail at autovacuum in 8.1 yet, but I know that in
> previous versions it was a bad idea to depend on it to vacuum a small
> table that has a lot of update activity frequently enough. The issue is
> that since it's single-threaded if it starts a vacuum on a large table
> it could be hours before it gets around to vacuuming the small table
> again.

Does it really make a lot of difference?  While the big vacuum is
running, old tuples accumulate on the small table, because it shows as a
running transaction and the small vacuum won't delete them.  The new
autovacuum is no different than the old one in this regard.  (There's a
patch by Hannu Krossing IIRC that, if included in 8.2, will make things
better.)

However, one thing that is different from old autovacuum is that you can
set better thresholds for small tables.  You don't have to wait until a
thousand tuples have accumulated -- you can change the threshold
inserting a tuple in pg_autovacuum.  In the 72-tuples case, I'd try
setting the vacuum threshold to 100 and see if it improves matters.


However, I'm looking at the autovacuum code to see why it's sitting
holding locks on the small table and not vacuuming it.  I see on the
pg_locks output that process 3158 (autovacuum) has got locks on the
table and index, but it apparently isn't vacuuming the table.  If this
is correct, it's a bug.  However I can't seem to find out why this
happens.

Kevin, Jeff, next time this happens please attach gdb to the autovacuum
process and get a stack trace ("bt" to gdb), if at all possible, and/or
strace it to see what it's doing.

--
Alvaro Herrera                                http://www.PlanetPostgreSQL.org
"I personally became interested in Linux while I was dating an English major
who wouldn't know an operating system if it walked up and bit him."
(Val Henson)

pgsql-admin by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: Vacuum Full Analyze Stalled
Next
From: "Steuckrath, Randy A"
Date:
Subject: Re: PgAdmin3 1.2.2 Install on Win32 Disrupts Pg Service