Home  >  Article  >  Database  >  Oracle 子表外键需不需要索引

Oracle 子表外键需不需要索引

WBOY
WBOYOriginal
2016-06-07 17:12:181032browse

一般情况下, Oracle 子表的外键需要添加索引, 如果外键不添加索引, 一下3种情况会导致 修改父表会锁住子表 1、更新父表主键,

一般情况下, Oracle 子表的外键需要添加索引,

如果外键不添加索引, 一下3种情况会导致 修改父表会锁住子表

1、更新父表主键,子表会被锁住

2、删除父表一行, 整个子表会被锁住

3、合并到父表,子表会被锁住。(9i,,10G是这样,11G不会)。

如果满足以下三种情况,则不需要在外键建立索引

1、没有从父表删除数据

2、没有更新父表主键

3、没有父表关联到子表

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn