Do I need to create indexes on foreign keys on Oracle?

aw crud picture aw crud · Nov 8, 2010 · Viewed 68.2k times · Source

I have a table A and a table B. A has a foreign key to B on B's primary key, B_ID.

For some reason (I know there are legitimate reasons) it is not using an index when I join these two tables on the key.

Do I need to separately create an index on A.B_ID or should the existence of a foreign key provide that?

Answer

DCookie picture DCookie · Nov 8, 2010

The foreign key constraint alone does not provide the index on Oracle - one must (and should) be created.