Does Oracle automatically create a secondary index for FOREIGN KEY columns?

。_饼干妹妹 提交于 2019-12-08 14:37:54

问题


I'm currenly developing on Oracle. I have several tables for which I defined FOREIGN KEY constraints. I have already read this SQL Server-oriented and this MySQL-oriented questions but I could find none about Oracle.

So the question is always the same: in order to optimize query performance, for those columns for which I create a FOREIGN KEY constraint, do I also have to create an explicit secondary index? Doesn't Oracle automatically create an index on FOREIGN KEYed columns to boost performances during JOINs?

I usually perform queries in which the WHERE clause compare against those columns.


回答1:


No, Oracle doesn't automatically create indexes on foreign key columns, even though in 99% of cases you probably should. Apart from helping with queries, the index also improves the performance of delete statements on the parent table.



来源:https://stackoverflow.com/questions/9262934/does-oracle-automatically-create-a-secondary-index-for-foreign-key-columns

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!