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


基础教程推荐
- SQL Server 2016更改对象所有者 2022-01-01
- 如何在 SQL Server 的嵌套过程中处理事务? 2021-01-01
- SQL Server 中单行 MERGE/upsert 的语法 2021-01-01
- 将数据从 MS SQL 迁移到 PostgreSQL? 2022-01-01
- 使用pyodbc“不安全"的Python多处理和数据库访问? 2022-01-01
- 无法在 ubuntu 中启动 mysql 服务器 2021-01-01
- ERROR 2006 (HY000): MySQL 服务器已经消失 2021-01-01
- 在 VB.NET 中更新 SQL Server DateTime 列 2021-01-01
- Sql Server 字符串到日期的转换 2021-01-01
- SQL Server:只有 GROUP BY 中的最后一个条目 2021-01-01