Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 2165B64FD05 for ; Tue, 28 Oct 2008 06:45:42 -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 89138-01 for ; Tue, 28 Oct 2008 06:45:39 -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 24F4264FCEE for ; Tue, 28 Oct 2008 06:45:39 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by mail.televork.ee (Postfix) with ESMTP id A63C3180FEB; Tue, 28 Oct 2008 11:45:35 +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 Wx7cTzRpSnnx; Tue, 28 Oct 2008 11:45:28 +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 C25DC1808C8; Tue, 28 Oct 2008 11:45:27 +0200 (EET) Subject: Re: VACUUMs and WAL From: Hannu Krosing To: Simon Riggs Cc: pgsql-hackers In-Reply-To: <1225183785.3971.114.camel@ebony.2ndQuadrant> References: <1225183785.3971.114.camel@ebony.2ndQuadrant> Content-Type: text/plain Date: Tue, 28 Oct 2008 11:45:30 +0200 Message-Id: <1225187130.7721.5.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/1377 X-Sequence-Number: 126394 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 ? > 2. Then we scan the index, issuing WAL records as appropriate. > > 3. Then we rescan the heap, issuing a HEAP2 clean record for every > block. > > I don't see a reason why we would issue 2 WAL records per block for a > VACUUM, nor why we would prune and remove in two steps, dirtying the > block each time. The first pass should just be collecting info and not dirtying anything. Could it be side effect of setting some transaction visibility bits on first visit ? In that case It would be good, if we could disable doing that that for vacuum. > Seems like we could write approximately half the amount > of data that we do. > > Surely we can come up with a better plan than that one? ------------------- Hannu Krosing http://www.2ndQuadrant.com PostgreSQL Scalability Training, Services and Support