Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Why should the foreign key column be indexed ?

james_pFeb 18 2022

DB Version : 19c 

In Oracle, is it always a good idea to index a foreign key column ?
Is the below mentioned reason the primary reason to index foreign keys in Oracle ?

"As a general rule, the need to define a foreign key implies that there will be SQL statements that require a join of the parent and child tables. Without a foreign key index, this SQL could not perform a nested loops join, and a more expensive sort merge join might be required"

select
  cust_name, order_details
from
  cust c,
  ordor o,
where
  c.cust_id = o.cust_id;

Source: http://www.dba-oracle.com/t_foreign_key_indexing.htm

Comments
Post Details
Added on Feb 18 2022
7 comments
2,702 views