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

后端 未结 7 539
粉色の甜心
粉色の甜心 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:25

    SQL Server has never put indexes onto foreign key columns automatically - check out Kim Tripp's excellent blog post on the background and history of this urban myth.

    It's usually a good idea to index your foreign key columns, however - so yes, I would recommend making sure each FK column is backed up by an index; not necessarily on that one column alone - maybe it can make sense to create an index on two or three columns with the FK column as the first one in there. Depends on your scenario and your data.

提交回复
热议问题