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

Home -> Community -> Mailing Lists -> Oracle-L -> add index to a unique-constrained column--how come?

add index to a unique-constrained column--how come?

From: Pardee, Roy E <roy.e.pardee_at_lmco.com>
Date: Tue, 19 Feb 2002 13:49:13 -0800
Message-ID: <F001.004138CB.20020219134913@fatcity.com>


The Oracle9i Database Administrator's Guide says:

> Creating a Unique Index Explicitly
>
> Indexes can be unique or nonunique. Unique indexes guarantee that
> no two rows of a table have duplicate values in the key column
> (or columns). Nonunique indexes do not impose this restriction on
> the column values.
>
> Use the CREATE UNIQUE INDEX statement to create a unique index.
> The following example creates a unique index:
>
> CREATE UNIQUE INDEX dept_unique_index ON dept (dname)
> TABLESPACE indx;
>
> Alternatively, you can define UNIQUE integrity constraints on the
> desired columns. Oracle enforces UNIQUE integrity constraints by
> automatically defining a unique index on the unique key. This is
> discussed in the following section. However, it is advisable that
> any index that exists for query performance, including unique
> indexes, be created explicitly

(See it at
http://download-west.oracle.com/otndoc/oracle9i/901_doc/server.901/a90117/in dexes.htm#10069)

If there's already an index there for the constraint, why do we want an additional one? Does it take up space? Will the implicit (is that the right word?) index not be used in queries if you don't also create an explicit one?

Thanks!

-Roy

Roy Pardee
Programmer/Analyst
SWFPAC Lockheed Martin IT
Extension 8487

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Pardee, Roy E
  INET: roy.e.pardee_at_lmco.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Feb 19 2002 - 15:49:13 CST

Original text of this message

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