Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id BE69264FC56 for ; Tue, 28 Oct 2008 08:00:09 -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 08158-04 for ; Tue, 28 Oct 2008 07:59:57 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ik-out-1112.google.com (ik-out-1112.google.com [66.249.90.176]) by postgresql.org (Postfix) with ESMTP id 25D9364FD2A for ; Tue, 28 Oct 2008 07:59:56 -0300 (ADT) Received: by ik-out-1112.google.com with SMTP id c21so719467ika.3 for ; Tue, 28 Oct 2008 03:59:55 -0700 (PDT) Received: by 10.210.51.18 with SMTP id y18mr8144170eby.103.1225191594771; Tue, 28 Oct 2008 03:59:54 -0700 (PDT) Received: from oxford.xeocode.com.enterprisedb.com ([82.16.16.210]) by mx.google.com with ESMTPS id h6sm7442404nfh.21.2008.10.28.03.59.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 28 Oct 2008 03:59:53 -0700 (PDT) To: Simon Riggs Cc: pgsql-hackers Subject: Re: VACUUMs and WAL In-Reply-To: <1225183785.3971.114.camel@ebony.2ndQuadrant> (Simon Riggs's message of "Tue\, 28 Oct 2008 08\:49\:45 +0000") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-Draft-From: ("nnimap+imap.gmail.com:HACKERS" 47287) References: <1225183785.3971.114.camel@ebony.2ndQuadrant> From: Gregory Stark Organization: EnterpriseDB Date: Tue, 28 Oct 2008 10:59:51 +0000 Message-ID: <87bpx5c7dk.fsf@oxford.xeocode.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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/1382 X-Sequence-Number: 126399 Simon Riggs writes: > 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. 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? This sounds like the same issue Pavan identified and proposed solving by rotating the three passes so that we do step 3 at the beginning of the next vacuum run, so it can be done in the same pass as step 1. To do that he proposed we do: 1. scan heap doing two things: a) remove any marked tuples if they were marked by a previous vacuum which committed and b) prune and mark any tuples we find are deletable for a future vacuum to remove. 2. scan indexes and remove the tuples we marked in 1b. The main blocking issue IIRC was: How to mark the tuples in a way which is safe if vacuum aborts. He suggested putting a vacuum xid in pg_class. Other suggestions were to mark the pages in the page header (which I thought made the most sense) or to put the xid in the line pointer (since nothing else needs to go there, the tuples are already cleaned). There might also have been a question of how to deal with the statistics. -- Gregory Stark EnterpriseDB http://www.enterprisedb.com Ask me about EnterpriseDB's 24x7 Postgres support!