Re: a few questions (and doubts) about xid

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: a few questions (and doubts) about xid
Дата
Msg-id 20070725154609.GD2581@alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: a few questions (and doubts) about xid  (Gregory Stark <stark@enterprisedb.com>)
Ответы Re: a few questions (and doubts) about xid  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-general
Gregory Stark wrote:

> > Just for confirmation: the relfrozenxid of a fresh table is the xid of the
> > transaction that created it, isn't it?
>
> Yes, easily enough checked:
>
> postgres=# create table xyz (i integer);
> CREATE TABLE
> postgres=# select xmin,relfrozenxid from pg_class where relname = 'xyz';
>   xmin   | relfrozenxid
> ---------+--------------
>  4971524 |      4971524
> (1 row)

No it's not.  It's the XID of the earliest transaction that was open at
the time you created the table (known as RecentXid).

The idea of relfrozenxid is to be "the earliest XID that is written
anywhere on a tuple on this table".  When the table is created, the
earliest XID is not the one of the creating transaction, because there
can be an older transaction that inserts a new tuple when the creating
transaction commits.

When VACUUM scans the table, it uses a "freeze cutoff point" (meaning
the XID before which all XIDs are going to be folded into FrozenXid)
which is what stored into relfrozenxid.  In 8.3, the rewriting forms of
ALTER TABLE, CLUSTER and TRUNCATE also advance the relfrozenxid.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

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

Предыдущее
От: Michael Fuhr
Дата:
Сообщение: Re: Backslah in encrypt function.
Следующее
От: "L. Berger"
Дата:
Сообщение: More than one characters in DELIMITER (for COPY)