Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: indexes
I think if you have a composite PK of A,B and C, then if you want RI, then
your FK should also be a composite key of all the three.
Moreover, it is better to create indexes on FK columns....
Correct me if I am wrong.
Thanks
Vidya
From: Webber Valerie H <Valerie.H.Webber_at_irs.gov>
Reply-To: ORACLE-L_at_fatcity.com
To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
Subject: RE: indexes
Date: Wed, 10 May 2000 22:27:42 -0800
Chris,
You hit the nail on the head! Does anyone know if this is true about indexes/PK/FK?
Val
-----Original Message-----
Sent: Tuesday, May 09, 2000 5:32 PM
To: Multiple recipients of list ORACLE-L
Good question, I've wondered the same thing. Add to that question if you have a Primary key with 3 columns A,B,C in the PK and have a foreign key on column A,B will the PK index be used for A,B to prevent the table lock on the referenced table.
-----Original Message-----
Sent: Tuesday, May 09, 2000 4:37 PM
To: Multiple recipients of list ORACLE-L
Is it safe to say that Oracle will use the composite index on A,B,C if A is a foreign key. What I'm getting at is that I don't need a separate index on column A which is a foreign key if I already have the composite index A,B,C
Thanks for all the help!
Val
-----Original Message-----
Sent: Tuesday, May 09, 2000 12:35 PM
To: Multiple recipients of list ORACLE-L
Valerie,
I believe it can use the A column of the index, but not the C column, so depending on how selective A is, this may or may not be a good thing.
Gary
Gary Kirsh
Next Extent, Inc.
-----Original Message-----
Sent: Tuesday, May 09, 2000 11:10 AM
To: Multiple recipients of list ORACLE-L
I know this issue has been discussed before but I can't find the answer in my list archives.
If you have a composite index on a table consisting of columns A,B,C in that order, will the index be used if I have a query/where clause on columns A and C?
I know that it will if I query on A alone or A,B or A,B,C but I can't find documentation about A and C (no B)
Thanks in advance!
Val
Valerie H. Webber
Management Systems Designers, Inc
Valerie.H.Webber_at_m1.irs.gov
704-569-1002 x107
--
Author: Chris Griffith
INET: Chris.Griffith_at_dstm.com
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Liststo: 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).
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
![]() |
![]() |