Search Postgresql Archives

Re: OID's

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>   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.

Attachment: pgpQqpM8tfC25.pgp
Description: PGP signature


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux