About OIDs

Started by Flower Sunabout 23 years ago14 messagesgeneral
Jump to latest
#1Flower Sun
sun_2002_flower@yahoo.com

Hi, group,

(1) I found system tables are all created without OIDs.
But the default behavior of creating user tables are with OIDs.
Is there any benefit to create user tables with OIDs?

(2) I heard that OID usage at row level will be a future problems.

(3) What's your preference to create table with OIDs or not.

(4) Will drop the whole database release used OIDs?

Thank you

---------------------------------
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!

#2Jonathan Bartlett
johnnyb@eskimo.com
In reply to: Flower Sun (#1)
Re: About OIDs

The OID concept is great. Sadly, since they are only 32-bit they can be
problematic. I usually create tables without OIDS and create a field
called object_id of type int8 that uses a global sequence called
'objects'.

The advantage OIDs still have is that OIDs are shown in the data
dictionary.Therefore, with OIDs, you can write a script to merge two
records, and search the data dictionary for any OID-related fields, and
update the related fields with the new OID for the merged record. This
works even if you don't know what tables and columns may be referencing
your table beforehand.

Anyway, that's my take. I'm interested in what other developers have to
say.

Jon

On Thu, 27 Mar 2003, Flower Sun wrote:

Show quoted text

Hi, group,

(1) I found system tables are all created without OIDs.
But the default behavior of creating user tables are with OIDs.
Is there any benefit to create user tables with OIDs?

(2) I heard that OID usage at row level will be a future problems.

(3) What's your preference to create table with OIDs or not.

(4) Will drop the whole database release used OIDs?

Thank you

---------------------------------
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!

#3Alvaro Herrera
alvherre@dcc.uchile.cl
In reply to: Flower Sun (#1)
Re: About OIDs

On Thu, Mar 27, 2003 at 12:42:37PM -0800, Flower Sun wrote:

(1) I found system tables are all created without OIDs.

There's no way to do this. All system tables have OIDs.

But the default behavior of creating user tables are with OIDs.
Is there any benefit to create user tables with OIDs?

No, unless you explicitly use them.

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"Et put se mouve" (Galileo Galilei)

#4Dann Corbit
DCorbit@connx.com
In reply to: Alvaro Herrera (#3)
Re: About OIDs

-----Original Message-----
From: Alvaro Herrera [mailto:alvherre@dcc.uchile.cl]
Sent: Thursday, March 27, 2003 1:29 PM
To: Flower Sun
Cc: Pgsql Group
Subject: Re: [GENERAL] About OIDs

On Thu, Mar 27, 2003 at 12:42:37PM -0800, Flower Sun wrote:

(1) I found system tables are all created without OIDs.

There's no way to do this. All system tables have OIDs.

But the default behavior of creating user tables are with OIDs. Is
there any benefit to create user tables with OIDs?

No, unless you explicitly use them.

They are very handy for our ODBC driver. It ensures that there is
always some sort of unique identifier for any table, even if the
designer did not create a primary key. (Sure, that's a naughty no-no,
but it is astonishing how often it happens). At any rate, some complex
joins can be sped up enormously by the existence of Odes.

#5Flower Sun
sun_2002_flower@yahoo.com
In reply to: Alvaro Herrera (#3)
Re: About OIDs

Hi, Alvaro,
Thank you for your reply. Well, if you view the system defination from PgAdminII 1.4.12, you will see the following one example which shows that no OIDs. I am not sure whether PgadminII is right or you are right on this topic.

-- Table: pg_amop

CREATE TABLE pg_amop (

amopclaid oid,

amopstrategy int2,

amopreqcheck bool,

amopopr oid,

CONSTRAINT pg_amop_opc_opr_index UNIQUE (amopclaid, amopopr),

CONSTRAINT pg_amop_opc_strategy_index UNIQUE (amopclaid, amopstrategy)

) WITHOUT OIDS;

Alvaro Herrera <alvherre@dcc.uchile.cl> wrote:On Thu, Mar 27, 2003 at 12:42:37PM -0800, Flower Sun wrote:

(1) I found system tables are all created without OIDs.

There's no way to do this. All system tables have OIDs.

But the default behavior of creating user tables are with OIDs.
Is there any benefit to create user tables with OIDs?

No, unless you explicitly use them.

--
Alvaro Herrera ()
"Et put se mouve" (Galileo Galilei)

---------------------------------
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Alvaro Herrera (#3)
Re: About OIDs

Alvaro Herrera <alvherre@dcc.uchile.cl> writes:

On Thu, Mar 27, 2003 at 12:42:37PM -0800, Flower Sun wrote:

(1) I found system tables are all created without OIDs.

There's no way to do this. All system tables have OIDs.

Some do, some don't. We don't bother with OIDs in the tables that have
no need for them (because their entries don't define referenceable
objects).

regards, tom lane

#7Andrew Bartley
abartley@evolvosystems.com
In reply to: Flower Sun (#1)
Re: About OIDs

(2) I heard that OID usage at row level will be a future problems.

Problems encuntered at the row level are only a consideration if you are expecting a very large number of temp tables or the constant creation and dropping of objects along with very large volumes of transactional type data. Otherwise it should not be a problem.

Regards

Andrew Bartley

#8Jonathan Bartlett
johnnyb@eskimo.com
In reply to: Dann Corbit (#4)
Re: About OIDs

but it is astonishing how often it happens). At any rate, some complex
joins can be sped up enormously by the existence of Odes.

Like what? I'm very curious on this point.

Jon

Show quoted text

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

#9Martijn van Oosterhout
kleptog@svana.org
In reply to: Dann Corbit (#4)
Re: About OIDs

On Thu, Mar 27, 2003 at 01:44:06PM -0800, Dann Corbit wrote:

They are very handy for our ODBC driver. It ensures that there is
always some sort of unique identifier for any table, even if the
designer did not create a primary key. (Sure, that's a naughty no-no,
but it is astonishing how often it happens). At any rate, some complex
joins can be sped up enormously by the existence of Odes.

OIDs are not necessarily unique. How do you handle that?

--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

Show quoted text

"the West won the world not by the superiority of its ideas or values or
religion but rather by its superiority in applying organized violence.
Westerners often forget this fact, non-Westerners never do."
- Samuel P. Huntington

#10Dann Corbit
DCorbit@connx.com
In reply to: Martijn van Oosterhout (#9)
Re: About OIDs

-----Original Message-----
From: Martijn van Oosterhout [mailto:kleptog@svana.org]
Sent: Thursday, March 27, 2003 5:39 PM
To: Dann Corbit
Cc: Pgsql Group
Subject: Re: [GENERAL] About OIDs

On Thu, Mar 27, 2003 at 01:44:06PM -0800, Dann Corbit wrote:

They are very handy for our ODBC driver. It ensures that there is
always some sort of unique identifier for any table, even if the
designer did not create a primary key. (Sure, that's a

naughty no-no,

but it is astonishing how often it happens). At any rate, some
complex joins can be sped up enormously by the existence of Odes.

OIDs are not necessarily unique. How do you handle that?

I do assume that they are unique within a single table's Oid set.
However, I create a unique index on the Oid column, so even when the
counter does wrap, I get a failure and an error message (yes, it has
happened).

When the failure does occur, I am forced to drop the database and
rebuild it. I will have a better solution once the 7.x official win32
port becomes available. God willing and the crick don't rise.

#11Flower Sun
sun_2002_flower@yahoo.com
In reply to: Dann Corbit (#10)
Re: About OIDs

Hi, Dann,
Do you think every database within a postgresql server has its own 32bits OID to use?
Thank you
Dann Corbit <DCorbit@connx.com> wrote:> -----Original Message-----

From: Martijn van Oosterhout [mailto:kleptog@svana.org]
Sent: Thursday, March 27, 2003 5:39 PM
To: Dann Corbit
Cc: Pgsql Group
Subject: Re: [GENERAL] About OIDs

On Thu, Mar 27, 2003 at 01:44:06PM -0800, Dann Corbit wrote:

They are very handy for our ODBC driver. It ensures that there is
always some sort of unique identifier for any table, even if the
designer did not create a primary key. (Sure, that's a

naughty no-no,

but it is astonishing how often it happens). At any rate, some
complex joins can be sped up enormously by the existence of Odes.

OIDs are not necessarily unique. How do you handle that?

I do assume that they are unique within a single table's Oid set.
However, I create a unique index on the Oid column, so even when the
counter does wrap, I get a failure and an error message (yes, it has
happened).

When the failure does occur, I am forced to drop the database and
rebuild it. I will have a better solution once the 7.x official win32
port becomes available. God willing and the crick don't rise.

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

---------------------------------
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!

#12Dann Corbit
DCorbit@connx.com
In reply to: Flower Sun (#11)
Re: About OIDs

-----Original Message-----
From: Flower Sun [mailto:sun_2002_flower@yahoo.com]
Sent: Friday, March 28, 2003 9:13 AM
To: Dann Corbit; Pgsql Group
Subject: Re: [GENERAL] About OIDs

Hi, Dann,
Do you think every database within a postgresql server has its own
32bits OID to use?

No. You can rely on them being present only if you build the tables
yourself.

Many other database systems have a similar idea. For instance, Oracle's
Rdb has a DBKEY.

In Codd's latest "Database Manifesto" he suggests doing away with them
(along with SQL itself).
I think he has been sitting in an ivory tower too long, but what do I
know.
<<

#13Flower Sun
sun_2002_flower@yahoo.com
In reply to: Dann Corbit (#12)
Re: About OIDs

If OIDS are for the whole postgresql server, not for individual database.
You have to drop all the databases in order to reuse OIDS, I think, which is not good for those companys who let host company hosting their databases. Because there are many other companys using the same postgresql server at the same time. And you have no idea whether other companys' tables are created with OIDS or not.
I think OID is equivlent to Oracle ROWID which is 64bits right now. ROWID don't have exhaustion problem.

Dann Corbit <DCorbit@connx.com> wrote:-----Original Message-----
From: Flower Sun [mailto:sun_2002_flower@yahoo.com]
Sent: Friday, March 28, 2003 9:13 AM
To: Dann Corbit; Pgsql Group
Subject: Re: [GENERAL] About OIDs

Hi, Dann,
Do you think every database within a postgresql server has its own
32bits OID to use?

No. You can rely on them being present only if you build the tables
yourself.

Many other database systems have a similar idea. For instance, Oracle's
Rdb has a DBKEY.

In Codd's latest "Database Manifesto" he suggests doing away with them
(along with SQL itself).
I think he has been sitting in an ivory tower too long, but what do I
know.
<<

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

---------------------------------
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!

#14Andrew Sullivan
andrew@libertyrms.info
In reply to: Jonathan Bartlett (#2)
Re: About OIDs

On Thu, Mar 27, 2003 at 01:14:30PM -0800, Jonathan Bartlett wrote:

update the related fields with the new OID for the merged record. This
works even if you don't know what tables and columns may be referencing
your table beforehand.

Really? Since there's no guarantee that OIDs are unique across the
system, that sounds like a terrible recipe for breakage to me.

A

-- 
----
Andrew Sullivan                         204-4141 Yonge Street
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M2P 2A8
                                         +1 416 646 3304 x110