【发布时间】:2013-10-08 19:24:32
【问题描述】:
我在生产(Oracle)中运行这个查询,它需要超过 3 分钟。有没有办法减少执行时间? svc_order 和 event 表都包含近 100 万条记录。
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'
【问题讨论】:
-
“我无法创建索引”。为什么不?而且 50 到 60k 条记录当然不是一个庞大的数据量。
-
Java 与它有什么关系?
-
你想打钉子,你不能用锤子。这很好(我们在现实生活中都面临着荒谬的限制),但您应该更明确地说明导致您这样做的情况,以便我们提供有用的建议。例如。 “不允许使用铁工具,因为我们在强磁场下工作”。
-
@FlorinGhita:不需要。
-
哎呀,我没有观察到他实际上没有从表格中选择任何东西。这很重要。
标签: sql database performance oracle