Re: OID's

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Kostis Mentzelos <mentzelos(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: OID's
Date: 2004-11-17 11:49:50
Message-ID: 20041117114950.GB25482@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Just to clarify, there is a difference between OIDs and XIDs. Object
IDs (OID) are a system assigned field to every row that eventually
wraps around. If you don't use them in your application you'll hever
really have a problem. The only exception is that statements that
modify structures in the database (CREATE TRIGGER/TABLE/INDEX/etc) may
fail if you're unlucky enough to try them and it happens to be exactly
the OID of an existing thing of that type.

Most people don't create 4 billion rows in their database so it's not
an issue. People who do are recommended to create their high churn
tables WITHOUT OIDS so they don't get used as fast. As an added bonus,
in recent versions you can actually save diskspace by not having them.

Transaction IDs (XID) are a different story, they track transactions
and what is visible and what isn't. Transaction wraparound means that
rows will disappear when their transaction ID (which was considered in
the past) is now in the future. Since 7.2 this problem is avoided by
doing a database wide VACUUM (not necessarily FULL) at least once every
billion transactions. This is not an onerous requirement so people
don't run into this anymore.

Before 7.2 you'd simply find your data missing one morning as the only
way to reset the XID was with an initdb. If you're still running a busy
database on something older than that, you *really* need to consider
taking appropriate measures! 7.2 is already fairly old now and all of
the major database destroying issues from then are now fixed.

Hope this helps,

On Tue, Nov 16, 2004 at 01:06:57PM +0200, Kostis Mentzelos wrote:
> I have read about oid wraparound in many messages but I don't understand
> when it happens and when it is dangerus for my tables.
>
> It affects developers that uses OIDS in their queryies?
> What about database and tables (not total or total) disappearences?
>
> Kostis.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose an index scan if your
> joining column's datatypes do not match

--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to

  • Re: OID's at 2004-11-16 11:06:57 from Kostis Mentzelos

Responses

  • Re: OID's at 2004-11-17 12:07:00 from Terry Lee Tucker
  • Re: OID's at 2004-11-18 22:31:59 from Kostis Mentzelos

Browse pgsql-general by date

  From Date Subject
Next Message Magnus Hagander 2004-11-17 11:53:03 Re: Problems importing Unicode
Previous Message David Helgason 2004-11-17 11:41:04 Re: Controlling maximal on-disk size of a table