pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Simon Riggs <simon@2ndQuadrant.com>
To: Gregory Stark <stark@enterprisedb.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: VACUUMs and WAL
Date: Tue, 28 Oct 2008 11:04:51 +0000
Message-ID: <1225191891.3971.137.camel@ebony.2ndQuadrant> (raw)
In-Reply-To: <87bpx5c7dk.fsf@oxford.xeocode.com>
References: <1225183785.3971.114.camel@ebony.2ndQuadrant>
	<87bpx5c7dk.fsf@oxford.xeocode.com>


On Tue, 2008-10-28 at 10:59 +0000, Gregory Stark wrote:
> Simon Riggs <simon@2ndQuadrant.com> 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.

It's fairly hard to remove the second heap pass completely. 

I think what I am suggesting is two heap passes, but writing WAL and
dirtying blocks on only one of the passes.

The biggest I/O cost comes from the writes, not the reads, ISTM.

-- 
 Simon Riggs           www.2ndQuadrant.com
 PostgreSQL Training, Services and Support




view thread (11+ messages)  latest in thread

Message-ID: <1225191891.3971.137.camel@ebony.2ndQuadrant>
Permalink:  ../1225191891.3971.137.camel@ebony.2ndQuadrant/
Also on:    postgresql.org/message-id/1225191891.3971.137.camel@ebony.2ndQuadrant

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: simon@2ndQuadrant.com, stark@enterprisedb.com
  Subject: Re: VACUUMs and WAL
  In-Reply-To: <1225191891.3971.137.camel@ebony.2ndQuadrant>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox