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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: # of Indexes

Re: # of Indexes

From: A. Bardeen <abardeen1_at_yahoo.com>
Date: Tue, 27 Jun 2000 00:48:28 -0700 (PDT)
Message-Id: <10541.110504@fatcity.com>


Rajesh,

You don't mention which version of Oracle you're running, but changes were made to the way PK/unique constraint indexes are created in O8. Although the scenario for this would actually be slightly different (creating the constraint after the existing index), I suspect you're encountering it anyway.

In O8 if an existing index can be used to satisfy a PK or unique constraint, then an additional index for the constraint will NOT be created. This only affects tables with composite indexes.

For example if you have an existing index on columns A,B, then if you create a PK or unique constraint on A or B,A Oracle will use the existing index on A,B to enforce the constraint.

This is not a bug and is documented in the SQL Administrator's manual:

Chapter 17: General Management of Schema Objects

Section: Managing Constraints That Have Associated Indexes

When you create a UNIQUE or PRIMARY key, Oracle checks to see if an existing index can be used to enforce uniqueness for the constraint. If there is no such index, Oracle creates one.

When constraints associated with unique indexes are dropped or disabled, the index is dropped. Oracle can use non-unique indexes to enforce UNIQUE and PRIMARY key constraints. If you allow Oracle to create a UNIQUE index automatically, and constraints associated with UNIQUE index are dropped or disabled, then the index is dropped.  


The workaround is to create the constraints, so their accompanying indexes are created, BEFORE the additional indexes.

HTH,


Do You Yahoo!? Received on Tue Jun 27 2000 - 02:48:28 CDT

Original text of this message

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