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: Unique and non unique index

Re: Unique and non unique index

From: Martijn Tonies <m.tonies_at_upscene.removethis.com>
Date: Wed, 15 Mar 2006 23:42:25 +0100
Message-ID: <121h62sbs70eb2a@corp.supernews.com>

> > No the primary key index will always create the unique index.
> > The Non unique index are required to be created for faster data
> > retrieval and not for maintaining data integrity.
>
> Your information is incorrect.
> ---------------------------------------------------------------------
> SQL*Plus: Release 10.2.0.1.0 - Production on Wed Mar 15 08:52:21 2006
>
> Copyright (c) 1982, 2005, Oracle. All rights reserved.
>
> Connected to:
> Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
> With the Partitioning, OLAP and Data Mining options
>
> SQL> create table t (
> 2 col1 NUMBER(3),
> 3 col2 VARCHAR2(10));
>
> Table created.
>
> SQL> ALTER TABLE t
> 2 ADD CONSTRAINT pk_t
> 3 PRIMARY KEY (col1)
> 4 INITIALLY DEFERRED DEFERRABLE
> 5 USING INDEX
>
> Table altered.
>
> SQL> SELECT index_name, index_type, uniqueness
> 2 FROM user_indexes
>
> INDEX_NAME INDEX_TYPE UNIQUENES
> ------------------------------ --------------------------- ---------
> PK_T NORMAL NONUNIQUE
>
>
> Oracle can use either unique or non-unique indexes to support a primary
> key constraint.

Interesting. Would I be correct in assuming that it would take slightly more cycles to check for matches against this index?

-- 
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com
Received on Wed Mar 15 2006 - 16:42:25 CST

Original text of this message

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