Re: Is it safe to reset relfrozenxid without using vacuum?

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Is it safe to reset relfrozenxid without using vacuum?
Дата
Msg-id 20081118162406.GD4141@alvh.no-ip.org
обсуждение исходный текст
Ответ на Is it safe to reset relfrozenxid without using vacuum?  (Arctic Toucan <arctic_toucan@hotmail.com>)
Ответы Re: Is it safe to reset relfrozenxid without using vacuum?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-admin
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

В списке pgsql-admin по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Reliably determining whether the server came up
Следующее
От: Mischa Sandberg
Дата:
Сообщение: Re: Reliably determining whether the server came up