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 的外键上创建索引吗?


- 更改自动增量起始编号? 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- SQL 临时表问题 2022-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01