pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Greg Smith <greg@2ndQuadrant.com>
To: pgsql-admin@postgresql.org
Subject: Re: streaming replication and wraparound vacuuming
Date: Tue, 04 Oct 2011 22:51:33 -0700
Message-ID: <4E8BF065.1020105@2ndQuadrant.com> (raw)
In-Reply-To: <0370E60157CA7E4097D81B9E09728A9409A8701B31@MAILR001.mail.lan>
References: <0370E60157CA7E4097D81B9E09728A9409A8701B31@MAILR001.mail.lan>

On 09/30/2011 12:28 PM, Andrew Shved wrote:
>
> I have a set up where most of the data located in partitions of the 
> large table and that data never changes.  The only table that really 
> changes is current day's partition.  The problem is that transaction 
> wraparound vacuum generates a lot of traffic quite frequently on 
> partitions that never changed (technically read only).  This is 
> especially a problem with streaming replication due to enormous 
> amounts of logging activity that is being generated.  Is there a way 
> to limit or eliminate those frequent vacuum. Something akin to oralce 
> read only tablespace or a way to set frozen transaction xid on a 
> partition level?  Basically anything to make it less frequent 
> especially when there is zero activity on those tables after initial 
> loads.
>

There's not really a good answer to this yet.  Write-once data is common 
enough that I'd like to see some accelerated paths for adding it 
appear.  I'm not aware of anyone working in that direction right now though.

Normally writes in PostgreSQL can result in blocks being written out 
many times:

-pg_xlog image
-Initial write to data block on disk
-Write(s) to update hint bits
-Initial VACUUM
-XID wraparound VACUUM FREEZE

If you aggressively run VACUUM FREEZE yourself, setting 
vacuum_freeze_min_age and possibly autovacuum_freeze_max_age to lower 
values than the defaults, you might avoid some number of these multiple 
writes, which are wasted from your perspective.  Aim to commit and 
freeze as fast as possible afterwards, avoiding some of the intermediate 
writes you might otherwise see.  That's the best that can be done 
without some hacking on the server code.

-- 
Greg Smith   2ndQuadrant US    greg@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support  www.2ndQuadrant.us

view thread (2+ messages)

Message-ID: <4E8BF065.1020105@2ndQuadrant.com>
Permalink:  ../4E8BF065.1020105@2ndQuadrant.com/
Also on:    postgresql.org/message-id/4E8BF065.1020105@2ndQuadrant.com

 · 

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-admin@postgresql.org
  Cc: greg@2ndQuadrant.com
  Subject: Re: streaming replication and wraparound vacuuming
  In-Reply-To: <4E8BF065.1020105@2ndQuadrant.com>

* 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