Re: Why is vacuum_freeze_min_age 100m?

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Robert Haas" <robertmhaas(at)gmail(dot)com>, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Josh Berkus" <josh(at)agliodbs(dot)com>, <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Why is vacuum_freeze_min_age 100m?
Date: 2009-08-13 14:32:40
Message-ID: 4A83DDB802000025000299ED@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> Someone had the idea a while back of pre-freezing inserted tuples in
> the WAL-bypass case.

I'm sure I'm not the one who thought up the idea and first posted
about it, but I'm certainly an advocate for it.

> It seems like in theory you could have a background process that
> would iterate through dirty shared buffers and freeze tuples
> opportunistically before they are written back to disk, but I'm not
> sure that it would really be worth it.

We have routinely been doing a database-level VACUUM FREEZE after a
pg_dump | psql copy of a database, because:

(1) Otherwise, users experience abysmal performance running routine
queries as every tuple scanned has its hint bits set during simple
SELECT statements. The massive disk write levels during SELECTs was
very confusing at first, and if you search the archives, I'm sure
you'll find that I'm not the only one who's been confused by it.

(2) Otherwise, there looms a point where every tuple restored, which
is not subsequently updated or deleted, will need to be frozen by
autovacuum -- all at the same time. Unless you're paying
extraordinary attention to the issue, you won't know when it is
coming, but the day will come. Probably in the middle of some
time-critical process which is doing a lot of work.

(3) We want to get this done before starting the WAL archiving, to
prevent having massive quantities of WAL to transmit across the WAN.

(4) With our improved backup processes we have another reason -- our
PITR base backup space requirements and WAN bandwidth usage will be
higher if we don't start from a frozen state and stay frozen.

So really, we'd be pretty silly *not* to make sure that all tuples are
frozen and have hint bits set after a pg_dump | psql copy. It would
speed the process somewhat if the tuples could be written in that
state to start with.

-Kevin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-08-13 14:33:37 Re: Alpha 1 release notes
Previous Message Peter Eisentraut 2009-08-13 14:26:29 Re: Alpha 1 release notes

Browse pgsql-performance by date

  From Date Subject
Next Message Matthew Wakeling 2009-08-13 14:36:15 Re: How to run this in reasonable time:
Previous Message Greg Stark 2009-08-13 14:25:31 Re: How to run this in reasonable time: