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

Home -> Community -> Usenet -> c.d.o.server -> Unique Indexes - OraDoc contradictory?

Unique Indexes - OraDoc contradictory?

From: Marc Blum <marc_at_marcblum.de>
Date: Tue, 23 Jul 2002 21:01:22 +0200
Message-ID: <qg9rjuoggcpdaso2caq52varpluidmnkph@4ax.com>


Hi all,

in the Oracle 8i Documentation I found the following two passages:

Concepts

Unique and Nonunique Indexes
Indexes can be unique or nonunique. Unique indexes guarantee that no two rows of a table have duplicate values in the columns that define the index. Nonunique indexes do not impose this restriction on the column values. Oracle recommends that you do not explicitly define unique indexes on tables. Uniqueness is strictly a logical concept and should be associated with the definition of a table. Alternatively, define UNIQUE integrity constraints on the desired columns. Oracle enforces UNIQUE integrity constraints by automatically defining a unique index on the unique key.

Application Developer's Guide - Fundamentals

Creating Indexes for Use with Constraints All enabled unique and primary keys require indexes, and foreign keys should almost always be indexed. Although unique and primary keys can create unique indexes for you, when you need an index for performance reasons, you should not rely on an index that is automatically created for key columns. Instead, create the index first, by hand.

I'm a bit unsure, if there's a contradiction or if I'm missing the point.

To me, the first excerpt says:

You shall not define unique indexes on tables. You shall an integrity constraint and the index will build implicitely.

The second excerpt says:

You shall create first the index to support a constraint. Then you shall define constraint, which will use the index.

Maybe some guru can shed some light an this? Many thanks in advance

Marc Blum
mailto:marc_at_marcblum.de
http://www.marcblum.de Received on Tue Jul 23 2002 - 14:01:22 CDT

Original text of this message

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