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 -> Re: Difference: Uniq. Constraint & Index ?

Re: Difference: Uniq. Constraint & Index ?

From: DA Morgan <damorgan_at_psoug.org>
Date: Mon, 16 Oct 2006 18:20:55 -0700
Message-ID: <1161048050.280669@bubbleator.drizzle.com>


klabu wrote:
> alter table my_emp
> add constraint u_con unique (col_a) ;
>
> create unique index u_index on my_emp (col_a);
>
> What is the difference between Unique Constraint and Unique Index ?
> And under what circumstance(s) will their difference come into play ?
>
> thanks

In terms of the affect on the data there is essentially no difference.

However I would argue that you should never build a unique index.

Here are just a few of the differences:

1. Unique constraints put an entry into user_indexes
2. Unique indexes do not create an entry in user_constraints
3. You can not defer an index
4. You can not disable an index (except FBI)
5. Unique indexes have no equivalent to NORELY
6. Unique indexes have no equivalent to NOVALIDATE
-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Mon Oct 16 2006 - 20:20:55 CDT

Original text of this message

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