Can you run out of oids?

Started by Chris Hooverover 19 years ago5 messagesgeneral
Jump to latest
#1Chris Hoover
revoohc@gmail.com

Somewhat silly question, but is it possible to run out of OID's?

Since we upgraded to 8.1.3, I noticed that I can create tables without an
oid column. I am wondering if I should consider trying to rebuild the
existing tables to be built without OID.

If it is possible to run out of OID's, how can you tell how close you are to
the edge.

Thanks,

Chris

RH4.0
PG8.1.3

#2Martijn van Oosterhout
kleptog@svana.org
In reply to: Chris Hoover (#1)
Re: Can you run out of oids?

On Tue, Aug 01, 2006 at 02:02:18PM -0400, Chris Hoover wrote:

Somewhat silly question, but is it possible to run out of OID's?

Nope. When you reach 4 billion, they just start again at zero.

Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

Show quoted text

From each according to his ability. To each according to his ability to litigate.

#3Michael Fuhr
mike@fuhr.org
In reply to: Chris Hoover (#1)
Re: Can you run out of oids?

On Tue, Aug 01, 2006 at 02:02:18PM -0400, Chris Hoover wrote:

Somewhat silly question, but is it possible to run out of OID's?

It depends on what you mean by "run out." As the FAQ and documentation
mention, OIDs wrap around and aren't guaranteed to be unique.

http://www.postgresql.org/docs/faqs.FAQ.html#item4.12
http://www.postgresql.org/docs/8.1/interactive/datatype-oid.html
http://www.postgresql.org/docs/8.1/interactive/sql-createtable.html

Since we upgraded to 8.1.3, I noticed that I can create tables without an
oid column. I am wondering if I should consider trying to rebuild the
existing tables to be built without OID.

Avoid using OIDs; if you need a unique identifier use a serial or
bigserial column.

--
Michael Fuhr

#4Joshua D. Drake
jd@commandprompt.com
In reply to: Martijn van Oosterhout (#2)
Re: Can you run out of oids?

Martijn van Oosterhout wrote:

On Tue, Aug 01, 2006 at 02:02:18PM -0400, Chris Hoover wrote:

Somewhat silly question, but is it possible to run out of OID's?

Nope. When you reach 4 billion, they just start again at zero.

O.k. but there is a catch.. if you are using them, they can and will
wrap. So don't use OIDs.

Joshua D. Drake

Have a nice day,

=== The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive PostgreSQL solutions since 1997
http://www.commandprompt.com/

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Chris Hoover (#1)
Re: Can you run out of oids?

"Chris Hoover" <revoohc@gmail.com> writes:

Since we upgraded to 8.1.3, I noticed that I can create tables without an
oid column. I am wondering if I should consider trying to rebuild the
existing tables to be built without OID.

As things are currently set up, a table that's uselessly using OIDs
isn't going to have any serious impact on any other table. It might be
worth doing ALTER .... SET WITHOUT OIDS just to save the microseconds
required to generate an OID for each insert --- but I don't see another
reason.

regards, tom lane