From: Alvaro Herrera <alvherre@commandprompt.com>
To: Arctic Toucan <arctic_toucan@hotmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Is it safe to reset relfrozenxid without using vacuum?
Date: Tue, 18 Nov 2008 13:24:06 -0300
Message-ID: <20081118162406.GD4141@alvh.no-ip.org> (raw)
In-Reply-To: <BAY126-W258E8EA30779618A479BFE9C120@phx.gbl>
References: <BAY126-W258E8EA30779618A479BFE9C120@phx.gbl>
Arctic Toucan wrote:
>
> I have a heavily partitioned DW type database that has over 5,000
> tables in it. Data is only ever inserted, read and then truncated
> after some period of time. Once the table is truncated, the
> constraints are changed and the table is reused. This works well until
> Postgres hits the autovacuum_freeze_max_age, which I currently have
> set @ 1billion). Since these tables are only ever inserted to and
> truncated, they are not normally vacuumed(which is what I want, since
> data is typically going to be truncated before needing to be
> vacuumed).
AFAICS this should be safe. In fact, in 8.3 TRUNCATE advances
relfrozenxid. (Perhaps you should consider upgrading if possible.)
> UPDATE pg_class SET relfrozenxid = ( select relfrozenxid from pg_class
> where age(relfrozenxid) in (select min(age(relfrozenxid)) from
> pg_class where relkind = 'r') limit 1) WHERE relname = '<table being
> truncated>';
Tou could just obtain the xid of the transaction that's going to do the
import (for example by creating a temp table and getting it's xmin from
pg_class)
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
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: alvherre@commandprompt.com, arctic_toucan@hotmail.com
Subject: Re: Is it safe to reset relfrozenxid without using vacuum?
In-Reply-To: <20081118162406.GD4141@alvh.no-ip.org>
* 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