From: Alvaro Herrera <alvherre@commandprompt.com>
To: Maxim Boguk <maxim.boguk@gmail.com>
Cc: pgsql-bugs <pgsql-bugs@postgresql.org>
Subject: Re: BUG #5946: Long exclusive lock taken by vacuum (not full)
Date: Fri, 25 Mar 2011 11:16:08 -0300
Message-ID: <1301062308-sup-5944@alvh.no-ip.org> (raw)
In-Reply-To: <201103250856.p2P8ufGc004544@wwwmaster.postgresql.org>
References: <201103250856.p2P8ufGc004544@wwwmaster.postgresql.org>
Excerpts from Maxim Boguk's message of vie mar 25 05:56:41 -0300 2011:
> From documentation I know that vacuum (without full) can truncate empty
> pages from end of a relation if they are free and vacuum successfully grabed
> exclusive lock for short time.
>
> However, I wasn't ready to learn that 'short exclusive lock' can be 10-20
> minutes in some cases.
>
> In my case vacuum tried to truncate last 10-15GB from 100Gb relation, and
> each time (3) it was cost 10+ minutes of service downtime (because that
> table was completely locked).
>
> Is that correct behaviour? Are here any way to speedup that process or at
> least allow read-only queries during that time?
>
> PS: no exessive disk IO observed during that 10+ min locks.
I think you may be using a version prior to a fix we did to that code,
to have it avoid sleeping due to vacuum_cost_delay. This shouldn't
happen in 8.4 because it was fixed prior to that, though.
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
Branch: master Release: REL8_3_0 [21c27af65] 2007-09-10 17:58:45 +0000
Branch: REL8_2_STABLE Release: REL8_2_5 [053731ab0] 2007-09-10 17:58:50 +0000
Branch: REL8_1_STABLE Release: REL8_1_10 [e52f4ec32] 2007-09-10 17:58:56 +0000
Branch: REL8_0_STABLE Release: REL8_0_14 [a44103519] 2007-09-10 17:59:03 +0000
Remove the vacuum_delay_point call in count_nondeletable_pages, because we hold
an exclusive lock on the table at this point, which we want to release as soon
as possible. This is called in the phase of lazy vacuum where we truncate the
empty pages at the end of the table.
An alternative solution would be to lower the vacuum delay settings before
starting the truncating phase, but this doesn't work very well in autovacuum
due to the autobalancing code (which can cause other processes to change our
cost delay settings). This case could be considered in the balancing code, but
it is simpler this way.
--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: alvherre@commandprompt.com, maxim.boguk@gmail.com
Subject: Re: BUG #5946: Long exclusive lock taken by vacuum (not full)
In-Reply-To: <1301062308-sup-5944@alvh.no-ip.org>
References: <201103250856.p2P8ufGc004544@wwwmaster.postgresql.org> <1301062308-sup-5944@alvh.no-ip.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox