Do I need to create indexes on foreign keys on Oracle?(我需要在 Oracle 的外键上创建索引吗?)
问题描述
我有一张表 A
和一张表 B
.A
在 B
的主键 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.
这篇关于我需要在 Oracle 的外键上创建索引吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:我需要在 Oracle 的外键上创建索引吗?


基础教程推荐
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 在多列上分布任意行 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01