Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id A8DB664FD32 for ; Tue, 28 Oct 2008 09:28:12 -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 30041-02 for ; Tue, 28 Oct 2008 09:28:07 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.187]) by postgresql.org (Postfix) with ESMTP id DBB4564FD0F for ; Tue, 28 Oct 2008 09:28:06 -0300 (ADT) Received: by nf-out-0910.google.com with SMTP id c7so972338nfi.23 for ; Tue, 28 Oct 2008 05:28:05 -0700 (PDT) Received: by 10.210.109.10 with SMTP id h10mr8268414ebc.123.1225196885022; Tue, 28 Oct 2008 05:28:05 -0700 (PDT) Received: from ?88.195.116.231? (dsl-hkibrasgw2-ff74c300-231.dhcp.inet.fi [88.195.116.231]) by mx.google.com with ESMTPS id h1sm861090nfh.19.2008.10.28.05.28.03 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 28 Oct 2008 05:28:04 -0700 (PDT) Message-ID: <49070551.1090903@enterprisedb.com> Date: Tue, 28 Oct 2008 14:28:01 +0200 Organization: EnterpriseDB User-Agent: Mozilla-Thunderbird 2.0.0.16 (X11/20080724) MIME-Version: 1.0 To: Hannu Krosing CC: Simon Riggs , pgsql-hackers Subject: Re: VACUUMs and WAL References: <1225183785.3971.114.camel@ebony.2ndQuadrant> <1225187130.7721.5.camel@huvostro> <1225188645.3971.118.camel@ebony.2ndQuadrant> <1225196344.7694.2.camel@huvostro> In-Reply-To: <1225196344.7694.2.camel@huvostro> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit From: Heikki Linnakangas X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200810/1390 X-Sequence-Number: 126407 Hannu Krosing wrote: > On Tue, 2008-10-28 at 10:10 +0000, Simon Riggs wrote: >> On Tue, 2008-10-28 at 11:45 +0200, Hannu Krosing wrote: >>> On Tue, 2008-10-28 at 08:49 +0000, Simon Riggs wrote: >>>> Looking at a VACUUM's WAL records makes me think twice about the way we >>>> issue a VACUUM. >>>> >>>> 1. First we scan the heap, issuing a HEAP2 clean record for every block >>>> that needs cleaning. >>> IIRC the first heap pass just collects info and does nothing else. >>> Is this just an empty/do-nothing WAL record ? >> 8.3 changed that; it used to work that way. I guess I never looked at >> the amount of WAL being generated. > > I can't see how it is safe to do anything more than just lookups on > first pass. What's done in the first pass is the same HOT pruning that is done opportunistically on other page accesses as well. IIRC it's required for correctness, though I can't remember what exactly the issue was. I don't think the extra WAL volume is a problem; VACUUM doesn't generate much WAL, anyway. As for the extra data page writes it causes; yeah, that might cause some I/O that could be avoided, but remember that the first pass often dirties buffers anyway to set hint bits. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com