Re: [PERFORM] is a good practice to create an index on the oid?

From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
To: Edoardo Ceccarelli <eddy(at)axa(dot)it>
Cc: pgsql-jdbc(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org, pgsql-admin(at)postgresql(dot)org
Subject: Re: [PERFORM] is a good practice to create an index on the oid?
Date: 2004-04-27 02:48:01
Message-ID: 408DC9E1.8020704@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-jdbc pgsql-performance

> I am using the oid of the table as the main key and I've found that is
> not indexed (maybe because I have declared another primary key in the
> table)
>
> it is a good practice to create an index like this on the oid of a table?
> CREATE INDEX idoid annuncio400 USING btree (oid);

Yes it is - in fact you really should add a unique index, not just a
normal index, as you want to enforce uniqueness of the oid column. It
is theoretically possible to end up with duplicate oids in wraparound
situations.

Even better though is to not use oids at all, of course...

Chris

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Greg Sabino Mullane 2004-04-27 03:04:51 Re: delete cascade question
Previous Message Dave Cramer 2004-04-26 23:04:07 Re: [JDBC] is a good practice to create an index on the oid?

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2004-04-27 11:59:47 Re: [JDBC] [PERFORM] is a good practice to create an index on the
Previous Message Dave Cramer 2004-04-26 23:04:07 Re: [JDBC] is a good practice to create an index on the oid?

Browse pgsql-performance by date

  From Date Subject
Next Message Dave Cramer 2004-04-27 11:59:47 Re: [JDBC] [PERFORM] is a good practice to create an index on the
Previous Message Dave Cramer 2004-04-27 00:16:00 Re: Wierd context-switching issue on Xeon patch for 7.4.1