我需要在 Oracle 的外键上创建索引吗?

2021-12-21 00:00:00 indexing sql oracle

我有一张表 A 和一张表 B.AB 的主键 B_ID 上有一个到 B 的外键.

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.

我是否需要在 A.B_ID 上单独创建一个索引,或者是否应该存在外键?

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

推荐答案

外键约束本身并不提供 Oracle 上的索引 - 必须(并且应该)创建.

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

相关文章