Index on composite foreign key [message #650617] |
Thu, 28 April 2016 06:56 |
|
RaShi.Raj
Messages: 84 Registered: May 2014 Location: Bangalore
|
Member |
|
|
Hi,
I have a foreign key on multiple columns (col1, col2) and since I need to create an index on foreign keys to handle table lock, is it mandatory that index should also be in same order like index on (col1, col2) and not on (col2, col1)???
Thanks,
Rashi
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Index on composite foreign key [message #650638 is a reply to message #650636] |
Thu, 28 April 2016 10:06 |
Bill B
Messages: 1971 Registered: December 2004
|
Senior Member |
|
|
I would always create an index in the same order as my foreign key. It will work without it, but anytime you delete from the parent, oracle would have to do a full table scan on the child table to find out if their are children or to do a cascade delete and depending on the number of rows, that can take a long time.
|
|
|