Re: Indexing Question.

From: DavidJRoth <davidjroth_at_aol.com>
Date: 5 Feb 1995 19:09:01 -0500
Message-ID: <3h3pat$1dr_at_newsbf02.news.aol.com>


From: tvangod_at_ecst.csuchico.edu (Tyler Van Gorder)
>Date: 4 Feb 1995 22:17:48 GMT

>Message-ID: <3h0uec$lb_at_charnel.ecst.CSUChico.EDU>
 

>Hi, I had a question about indexes in Oracle:
 

>If you have a 4 part primary key do you need to define an index on each
>column or can you define an index on the entire key. If the second is
 t>he case, how is performance when say 2 of the 4 columns are supplied in
>a query?

If you use the primary key constraint (the recommended approach) Oracle will automatically create a unique index on all 4 columns. Even if you create the index manually, all 4 columns must be included to guarantee uniqueness.

As far as queries using the index;

If the columns in the index are A,B,C,D (in that order),

queies with where clauses for

A              or
A,B           or
A,B,C        or

A,B,C,D

can use the index.

David Roth

CMC Systems                                       All opinions expressed
UNIX Client/Server System Integrators      are my own.
(508) 392-1300x20 Received on Mon Feb 06 1995 - 01:09:01 CET

Original text of this message