查询性能&调音

时间:2015-04-09 12:56:33

标签: sql oracle performance optimization

想要优化Oracle Query。选择一个月的数据,大约需要24-26秒来显示数据。是否有可能优化,优化它,并在5-10秒左右花费更少的时间。您的反馈非常感谢。

select eutrancellfdd,
       startdate,
       max(connected_users)
from
(select eutrancellfdd,
        startdate,
        starthour,
        Round((case when pmrrcconnlevsamp_sum = 0 then 0
                 else (pmrrcconnlevsum/pmrrcconnlevsamp_sum) end),0) as connected_users
 from tblericsson)
group by eutrancellfdd, startdate
Having startdate between to_date('03/01/2015','MM/DD/YYYY') 
  AND to_date('04/01/2015','MM/DD/YYYY')
  and eutrancellfdd='L0253401'
order by startdate asc;      

1 个答案:

答案 0 :(得分:1)

尝试使用此查询。 另外检查eutrancellfdd和startdate列上是否有索引。

select eutrancellfdd,
       startdate,
       max(Round((case when pmrrcconnlevsamp_sum = 0 then 0
                 else (pmrrcconnlevsum/pmrrcconnlevsamp_sum) end),0))
from
where startdate between to_date('03/01/2015','MM/DD/YYYY') 
      AND to_date('04/01/2015','MM/DD/YYYY')
      and eutrancellfdd='L0253401'
group by eutrancellfdd, startdate
order by startdate asc;