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

-- 
Sent via pgsql-admin mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Reply via email to