Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id A9AFB650084 for ; Tue, 15 Jul 2008 10:52:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 03846-04 for ; Tue, 15 Jul 2008 10:52:20 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from lists.commandprompt.com (host-159.commandprompt.net [207.173.203.159]) by postgresql.org (Postfix) with ESMTP id 4E724650713 for ; Tue, 15 Jul 2008 10:52:26 -0300 (ADT) Received: from perhan.alvh.no-ip.org (190-95-31-93.bk17-dsl.surnet.cl [190.95.31.93]) (authenticated bits=0) by lists.commandprompt.com (8.13.8/8.13.8) with ESMTP id m6FDsZtm013483 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 15 Jul 2008 06:54:39 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 220E647C83; Tue, 15 Jul 2008 09:52:16 -0400 (CLT) Date: Tue, 15 Jul 2008 09:52:16 -0400 From: Alvaro Herrera To: Chris Hoover Cc: "pgsql-admin@postgresql.org Admin" Subject: Re: More Autovacuum questions Message-ID: <20080715135216.GB7334@alvh.no-ip.org> References: <1d219a6f0807150619o567709ebu7d28429d2907bf82@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1d219a6f0807150619o567709ebu7d28429d2907bf82@mail.gmail.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0 (lists.commandprompt.com [207.173.203.159]); Tue, 15 Jul 2008 06:54:40 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200807/130 X-Sequence-Number: 29740 Chris Hoover escribió: > Another question. > > When autovacuum sleeps, does it release the lock it has on the table? What do you mean sleep? There are two sleeps: the one caused by cost-based vacuum delay (lasts for some milliseconds, happens every handful of pages vacuumed; no locks released here) and the big sleep that happens after one worker finishes and the next one starts (all locks are released). When one autovac worker is processing a table, no other worker touches it. So if you have a table that's 64 GB, it won't be analyzed until the currently running vacuum finishes. > What we would like to have happen is for vacuum to work for a while, sleep, > and while it is sleeping run an analyze on the table. We need this due to > how quickly our data is changing. Currently we are running analyze every 5 > minutes against the table of question and get a very serious performance hit > when vacuum runs due to the index stats getting out of date. As soon as we > rerun analyze after the vacuum happiness returns. This is worst case for Postgres vacuuming, I think. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.