【发布时间】:2018-06-26 20:30:57
【问题描述】:
我有数百万条记录的表,我添加了两个新列
alter table hr.employees add (ind char(1Byte), remove Char(1 Byte)); commit;
我有另一个视图hr.department,它的数据比这更多,并且有这两列。
因此,如果我为这些记录编写和更新需要很长时间。
update hr.employees a
set (ind, remove) =(select ind, remove
from hr.department b
where a.dept_id = b.dept_id ) ;
一个小时过去了,更新还在继续。有人可以帮忙吗?
【问题讨论】:
-
你检查过执行计划了吗?如果 hr.department 中的列 dept_id 未编入索引,则查询将花费很长时间。