程序问答   发布时间:2022-06-02  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了如何减少海量数据表的查询执行时间大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决如何减少海量数据表的查询执行时间?

开发过程中遇到如何减少海量数据表的查询执行时间的问题如何解决?下面主要结合日常开发的经验,给出你关于如何减少海量数据表的查询执行时间的解决方法建议,希望对你解决如何减少海量数据表的查询执行时间有所启发或帮助;

查看您说的无法创建索引的内容。我希望查询对表进行全表扫描。请尝试并行提示。

select /*+ full(so) parallel(so, 4) */ 0 test_section, count(1) count, 'DD' test_section_value  
from svc_order so, event e  
where so.svc_order_ID = e.svc_order_ID  
  and so.entered_date >= to_date('01/01/2012', 'MM/DD/YYYY')  
  and e.event_type = 230 and e.event_level = 'O'  
  and e.current_sched_date between 
      to_date( '09/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS')
      and to_date('09/29/2013 23:59:59', 'MM/DD/YYYY HH24:MI:SS')  
  and (((so.sots_ta = 'N') and (so.action_type = 0)) 
       or  ((so.sots_ta is null) and (so.action_type = 0)) 
       or  ((so.sots_ta = 'N') and (so.action_type is null)))
  and so.company_code = 'LL'

解决方法

我正在生产(Oracle)中运行此查询,它耗时超过3分钟。有什么办法可以减少执行时间?svc_order和事件表均包含近一百万条记录。

select 0 test_section,count(1) count,'DD' test_section_value  
from svc_order so,event e  
where so.svc_order_id = e.svc_order_id  
  and so.entered_date >= to_date('01/01/2012','MM/DD/YYYY')  
  and e.event_type = 230 and e.event_level = 'O'  
  and e.current_sched_date between 
      to_date( '09/01/2010 00:00:00','MM/DD/YYYY HH24:MI:SS')
      and to_date('09/29/2013 23:59:59','MM/DD/YYYY HH24:MI:SS')  
  and (((so.sots_ta = 'N') and (so.action_type = 0)) 
       or  ((so.sots_ta is null) and (so.action_type = 0)) 
       or  ((so.sots_ta = 'N') and (so.action_type is null)))
  and so.company_code = 'LL'

大佬总结

以上是大佬教程为你收集整理的如何减少海量数据表的查询执行时间全部内容,希望文章能够帮你解决如何减少海量数据表的查询执行时间所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: