lazy vacuum sleeps with exclusive lock on table

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: lazy vacuum sleeps with exclusive lock on table
Date: 2007-06-28 21:16:54
Message-ID: 20070628211654.GD22200@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I noticed that lazy vacuum acquires an exclusive lock at the end, to be
able to truncate the table. This is not a surprise. If it cannot
acquire the lock, it simply skips truncating the table and goes on with
life.

However, what's problematic is that if a non-zero cost delay has been
set, it will happily take naps while determining what to truncate :-(
This seems a bad idea. It also may explain why some people is seeing
autovacuum blocking other processes. It also readily explains why this
is so when there are no non-granted locks for autovacuum.

Comments? I think we should remove the sleep in the truncate phase.

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2007-06-28 22:09:36 Re: SetBufferCommitInfoNeedsSave and race conditions
Previous Message Stephen Frost 2007-06-28 21:10:37 Re: 'SET LOCAL ROLE blah;' doesn't work?