Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 7C155650094 for ; Tue, 28 Oct 2008 09:46:10 -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 36035-02-7 for ; Tue, 28 Oct 2008 09:46:07 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.televork.ee (mail.televork.ee [81.21.241.190]) by postgresql.org (Postfix) with ESMTP id 1C7DA64FC56 for ; Tue, 28 Oct 2008 09:45:57 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.televork.ee (Postfix) with ESMTP id 9D90338B8; Tue, 28 Oct 2008 14:45:54 +0200 (EET) X-Virus-Scanned: at mail.televork.ee Received: from mail.televork.ee ([81.21.241.190]) by localhost (mail.televork.ee [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Rz+dGjrxcr6S; Tue, 28 Oct 2008 14:45:48 +0200 (EET) Received: from [127.0.0.1] (81-21-242-98.televork.ee [81.21.242.98]) by mail.televork.ee (Postfix) with ESMTP id 65D5D1826AA; Tue, 28 Oct 2008 14:45:48 +0200 (EET) Subject: Re: VACUUMs and WAL From: Hannu Krosing To: Heikki Linnakangas Cc: Simon Riggs , pgsql-hackers In-Reply-To: <49070551.1090903@enterprisedb.com> References: <1225183785.3971.114.camel@ebony.2ndQuadrant> <1225187130.7721.5.camel@huvostro> <1225188645.3971.118.camel@ebony.2ndQuadrant> <1225196344.7694.2.camel@huvostro> <49070551.1090903@enterprisedb.com> Content-Type: text/plain Date: Tue, 28 Oct 2008 14:45:48 +0200 Message-Id: <1225197948.7694.11.camel@huvostro> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Content-Transfer-Encoding: 7bit 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/1396 X-Sequence-Number: 126413 On Tue, 2008-10-28 at 14:28 +0200, Heikki Linnakangas wrote: > 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. Are you sure it is a correctness thing ? Maybe HOT pruning just happened to be in a path used by vacuum to read pages. > I don't think the extra WAL volume is a problem; Probably not ( unless you need to ship your WAL records via a very expensive network connection ). If it is a simple performance problem, then it can probably be fixed by just running VACUUM slower. > 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. Still, can't we special-case HOT pruning and hint-bit change WAL-logging for first the pass of vacuum ? They both seem redundant in case of VACUUM. --------------- Hannu