我一直在尝试优化以下查询的性能。我请求这个领域的所有专家给我一个帮助和建议。
我有应用程序。70k 条记录,我的要求是删除重复项。我需要提高以下查询的性能。
select *
from x.vw_records
where id not in
(select distinct id
from x.vw_datarecords
where effective_date >= trunc(sysdate - 30)
and book in (select book_shortname from x.vw_datarecords))
union
select distinct id
from x.vw_historyrecords
where effective_date >= trunc(sysdate - 30)
and book in (select book_shortname from x.vw_datarecords)
union
select distinct id
from x.vw_transactiondata
where effective_date >= trunc(sysdate - 30)
and book in (select book_shortname from x.vw_datarecords);
union
select distinct id
from x.vw_cashdata
where effective_date >= trunc(sysdate - 30)
and book in (select book_shortname from x.vw_datarecords)
目前需要十分钟来数数。使用计数(*)的行数。建议我调整此查询的性能的任何想法。
提前致谢。