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 的外键上创建索引吗?
基础教程推荐
- 从字符串 TSQL 中获取数字 2021-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- 带更新的 sqlite CTE 2022-01-01
