【发布时间】:2020-08-19 09:22:47
【问题描述】:
我想调整我的合并查询,该查询根据 SQL Server 中的源表在 Oracle 中插入和更新表。表大小约为 1.2 亿行,通常每天插入/更新约 12 万条记录。合并运行大约需要 1.5 小时。它使用嵌套循环和主键索引来执行插入和更新。 源表中没有记录更新日期可供使用;所以所有的记录都会被比较。
Merge abc tgt
using
(
select a,b,c
from sourcetable@sqlserver_remote) src
on (tgt.ref_id = src.ref_id)
when matched then
update set
.......
where
decode(tgt.a, src.a,1,0) = 0
or ......
when not matched then
insert (....) values (.....);
commit;
由于表很大并且每天都在增长,因此我在 DEV 中根据 ref id(10 个组)对表进行了分区,并在 ref id 上创建了本地索引。 现在它使用散列连接和全表扫描,运行时间比现有进程长。 当我从本地索引更改为全局索引 (ref_id) 时,我使用了嵌套循环,但运行时间仍然比现有进程长。
有没有办法对过程进行性能调整。
谢谢...
【问题讨论】:
标签: sql oracle merge oracle12c partitioning