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: Foreign Key and Index

Re: Foreign Key and Index

From: Andy <andy.spaven_at_eps-hq.co.uk>
Date: Thu, 1 Aug 2002 11:02:32 +0100
Message-ID: <FC729.245$9R.1261521@newsr2.u-net.net>


Jaret

So long as the FK column(s) is/are the leading column(s) of another index (due to PK constraint or a explicit index) you won't need to index it/them.

Example
PK - columns a,b,c,d

No index needed if
FK - columns a,b
FK - columns a

Index needed if

FK - columns a,c - because no b in FK
FK - columns b - because b is not leading column of PK index
FK - columns e,a - because e in not in PK index

Hope this helps

Andy

"Jaret Lafoudravecmonhai" <nospam_at_nospam.com> wrote in message news:aiarlp$17p$1_at_reader1.imaginet.fr...
> Hello,
>
> I must create some indexes on foreign keys to avoid some locing problems.
>
> Does the column indexes must be exactly the same as FK (exactly the same
> column, not more and same order) ? I've got a lot of existing index (PK
and
> other) including the FK column (but not the same order and more columns),
> and i don't want to make redundancy.
>
>
> Ludo
>
>
>
>
>
Received on Thu Aug 01 2002 - 05:02:32 CDT

Original text of this message

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