Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-adminpgsql-jdbcpgsql-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

pgsql-performance by date

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

pgsql-admin by date

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

pgsql-jdbc by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group