Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: What makes difference by creating an index or add a primary key to a table

Re: What makes difference by creating an index or add a primary key to a table

From: Ed prochak <ed.prochak_at_magicinterface.com>
Date: 11 Aug 2003 11:31:01 -0700
Message-ID: <4b5394b2.0308111031.56ff39c0@posting.google.com>


cschang <cschang_at_maxinter.net> wrote in message news:<3F37065E.39ABB2B5_at_maxinter.net>...
> Daniel:
> I have searched such subject on the web. Many concluded the same thing
> as you mentioned, but not much about the performance comparsion. According
> to the closest conclusion, does that mean I only need to create an index (
> or indexes) for speedy performance and I can ignore to create the primary key
> constraint provided that I do not care about the null value of the primary
> key. Besides, there is never be NULL to both column in my case, so whether
> or not the parimary key by two columns does not matter. I did found a
> response that claimed to be faster with the primary key verse the index (very
> similar case as my, but it is on SQL server). That's what I consern.
>

Passing along something I learned recently in comp.databases:  while I think ORACLE has supported multicolumn Primary keys where part of the key value (one or more columns) may be NULL, the SQL standard does not allow this. So to avoid possible problems in the future, you may want to rethink your choice for primary key columns.

As far as a primay key being faster than an index, that would seem to be impossible on ORACLE, since ORACLE creates an index with the Primary key.

HTH,
ed Received on Mon Aug 11 2003 - 13:31:01 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US