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

后端 未结 7 554
粉色の甜心
粉色の甜心 2020-12-02 11:27

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

Fo

7条回答
  •  孤城傲影
    2020-12-02 12:21

    For performance reasons an index should be created. Is used in delete operations on primary table (to check that the record you are deleting is not used) and in joins that usually a foreign key is involved. Only few tables (I do not create them in logs) could be that do not need the index but probably, in this cases probably you don't need the foreign key constraint as well.

    BUT

    There are some databases that already automatically create indexes on foreign Keys. Jet Engine (Microsoft Access Files) Firebird MySQL

    FOR SURE

    SQL Server Oracle

    DOES NOT

提交回复
热议问题