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